Revision 433c63aa
b/lib/backend.py | ||
---|---|---|
1926 | 1926 |
@return: snapshot disk path |
1927 | 1927 |
|
1928 | 1928 |
""" |
1929 |
if disk.children: |
|
1930 |
if len(disk.children) == 1: |
|
1931 |
# only one child, let's recurse on it |
|
1932 |
return BlockdevSnapshot(disk.children[0]) |
|
1933 |
else: |
|
1934 |
# more than one child, choose one that matches |
|
1935 |
for child in disk.children: |
|
1936 |
if child.size == disk.size: |
|
1937 |
# return implies breaking the loop |
|
1938 |
return BlockdevSnapshot(child) |
|
1929 |
if disk.dev_type == constants.LD_DRBD8: |
|
1930 |
if not disk.children: |
|
1931 |
_Fail("DRBD device '%s' without backing storage cannot be snapshotted", |
|
1932 |
disk.unique_id) |
|
1933 |
return BlockdevSnapshot(disk.children[0]) |
|
1939 | 1934 |
elif disk.dev_type == constants.LD_LV: |
1940 | 1935 |
r_dev = _RecursiveFindBD(disk) |
1941 | 1936 |
if r_dev is not None: |
1937 |
# FIXME: choose a saner value for the snapshot size |
|
1942 | 1938 |
# let's stay on the safe side and ask for the full size, for now |
1943 | 1939 |
return r_dev.Snapshot(disk.size) |
1944 | 1940 |
else: |
Also available in: Unified diff