diff --git a/lib/backend.py b/lib/backend.py index 306780870ef024bc4fdb939684584c902060dc3a..711d7bca939826106e85a6a8e19a6a9053c2b16e 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1926,19 +1926,15 @@ def BlockdevSnapshot(disk): @return: snapshot disk path """ - if disk.children: - if len(disk.children) == 1: - # only one child, let's recurse on it - return BlockdevSnapshot(disk.children[0]) - else: - # more than one child, choose one that matches - for child in disk.children: - if child.size == disk.size: - # return implies breaking the loop - return BlockdevSnapshot(child) + if disk.dev_type == constants.LD_DRBD8: + if not disk.children: + _Fail("DRBD device '%s' without backing storage cannot be snapshotted", + disk.unique_id) + return BlockdevSnapshot(disk.children[0]) elif disk.dev_type == constants.LD_LV: r_dev = _RecursiveFindBD(disk) if r_dev is not None: + # FIXME: choose a saner value for the snapshot size # let's stay on the safe side and ask for the full size, for now return r_dev.Snapshot(disk.size) else: