Revision 06c2fb4a lib/backend.py

b/lib/backend.py
2700 2700
    _Fail("Failed to grow block device: %s", err, exc=True)
2701 2701

  
2702 2702

  
2703
def BlockdevSnapshot(disk):
2703
def BlockdevSnapshot(disk, snapshot_name=None):
2704 2704
  """Create a snapshot copy of a block device.
2705 2705

  
2706 2706
  This function is called recursively, and the snapshot is actually created
......
2717 2717
      _Fail("DRBD device '%s' without backing storage cannot be snapshotted",
2718 2718
            disk.unique_id)
2719 2719
    return BlockdevSnapshot(disk.children[0])
2720
  elif disk.dev_type == constants.LD_LV:
2720
  elif disk.dev_type == constants.LD_LV and not snapshot_name:
2721 2721
    r_dev = _RecursiveFindBD(disk)
2722 2722
    if r_dev is not None:
2723 2723
      # FIXME: choose a saner value for the snapshot size
......
2725 2725
      return r_dev.Snapshot(disk.size)
2726 2726
    else:
2727 2727
      _Fail("Cannot find block device %s", disk)
2728
  elif disk.dev_type == constants.DT_EXT:
2729
    r_dev = _RecursiveFindBD(disk)
2730
    if r_dev is not None:
2731
      r_dev.Snapshot(snapshot_name)
2732
    else:
2733
      _Fail("Cannot find block device %s", disk)
2728 2734
  else:
2729 2735
    _Fail("Cannot snapshot non-lvm block device '%s' of type '%s'",
2730 2736
          disk.unique_id, disk.dev_type)

Also available in: Unified diff