Revision 3a9fe2bc lib/backend.py

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

  
2680 2680

  
2681
def BlockdevSnapshot(disk):
2681
def BlockdevSnapshot(disk, snapshot_name=None):
2682 2682
  """Create a snapshot copy of a block device.
2683 2683

  
2684 2684
  This function is called recursively, and the snapshot is actually created
......
2695 2695
      _Fail("DRBD device '%s' without backing storage cannot be snapshotted",
2696 2696
            disk.unique_id)
2697 2697
    return BlockdevSnapshot(disk.children[0])
2698
  elif disk.dev_type == constants.LD_LV:
2698
  elif disk.dev_type == constants.LD_LV and not snapshot_name:
2699 2699
    r_dev = _RecursiveFindBD(disk)
2700 2700
    if r_dev is not None:
2701 2701
      # FIXME: choose a saner value for the snapshot size
......
2703 2703
      return r_dev.Snapshot(disk.size)
2704 2704
    else:
2705 2705
      _Fail("Cannot find block device %s", disk)
2706
  elif disk.dev_type == constants.DT_EXT:
2707
    r_dev = _RecursiveFindBD(disk)
2708
    if r_dev is not None:
2709
      r_dev.Snapshot(snapshot_name)
2710
    else:
2711
      _Fail("Cannot find block device %s", disk)
2706 2712
  else:
2707 2713
    _Fail("Cannot snapshot non-lvm block device '%s' of type '%s'",
2708 2714
          disk.unique_id, disk.dev_type)

Also available in: Unified diff