Commit 800ac399 authored by Iustin Pop's avatar Iustin Pop
Browse files

Make snapshots multi-vg aware

Currently, the Snapshot() function of LogicalVolume returns only the
logical volume path, with the assumption that we only have one VG. But
with the recent changes, it makes more sense to return the full data (vg
and lv) from it, so as to not require computing it in the master.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent e0f9ed64
......@@ -2143,7 +2143,7 @@ def BlockdevSnapshot(disk):
@type disk: L{objects.Disk}
@param disk: the disk to be snapshotted
@rtype: string
@return: snapshot disk path
@return: snapshot disk ID as (vg, lv)
if disk.dev_type == constants.LD_DRBD8:
......@@ -694,6 +694,8 @@ class LogicalVolume(BlockDev):
def Snapshot(self, size):
"""Create a snapshot copy of an lvm block device.
@returns: tuple (vg, lv)
snap_name = self._lv_name + ".snap"
......@@ -715,7 +717,7 @@ class LogicalVolume(BlockDev):
_ThrowError("command: %s error: %s - %s",
result.cmd, result.fail_reason, result.output)
return snap_name
return (self._vg_name, snap_name)
def SetInfo(self, text):
"""Update metadata with info text.
......@@ -1151,8 +1151,6 @@ class ExportInstanceHelper:
instance = self._instance
src_node = instance.primary_node
vgname = self._lu.cfg.GetVGName()
for idx, disk in enumerate(instance.disks):
self._feedback_fn("Creating a snapshot of disk/%s on node %s" %
(idx, src_node))
......@@ -1160,13 +1158,17 @@ class ExportInstanceHelper:
# result.payload will be a snapshot of an lvm leaf of the one we
# passed
result = self._lu.rpc.call_blockdev_snapshot(src_node, disk)
new_dev = False
msg = result.fail_msg
if msg:
self._lu.LogWarning("Could not snapshot disk/%s on node %s: %s",
idx, src_node, msg)
new_dev = False
elif (not isinstance(result.payload, (tuple, list)) or
len(result.payload) != 2):
self._lu.LogWarning("Could not snapshot disk/%s on node %s: invalid"
" result '%s'", idx, src_node, result.payload)
disk_id = (vgname, result.payload)
disk_id = tuple(result.payload)
new_dev = objects.Disk(dev_type=constants.LD_LV, size=disk.size,
logical_id=disk_id, physical_id=disk_id,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment