Commit a97da6b7 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix two issues with exports and snapshot errors



This patch fixes two issues related to failed snapshots during exports:
  - first, the error messages used disk.logical_id[1], which is a node
    name for DRBD, and it resulted in strange error messages like
    "cannot snapshot block device node1 on node2"
  - second, if snapshotting fails for any disk, rpc.call_finalize_export
    fails as it didn't handle booleans (backend.FinalizeExport does)
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 2cd855dd
......@@ -6293,12 +6293,12 @@ class LUExportInstance(LogicalUnit):
self.cfg.SetDiskID(disk, src_node)
try:
for disk in instance.disks:
for idx, disk in enumerate(instance.disks):
# new_dev_name will be a snapshot of an lvm leaf of the one we passed
new_dev_name = self.rpc.call_blockdev_snapshot(src_node, disk)
if new_dev_name.failed or not new_dev_name.data:
self.LogWarning("Could not snapshot block device %s on node %s",
disk.logical_id[1], src_node)
self.LogWarning("Could not snapshot disk/%d on node %s",
idx, src_node)
snap_disks.append(False)
else:
new_dev = objects.Disk(dev_type=constants.LD_LV, size=disk.size,
......@@ -6323,13 +6323,12 @@ class LUExportInstance(LogicalUnit):
result = self.rpc.call_snapshot_export(src_node, dev, dst_node.name,
instance, cluster_name, idx)
if result.failed or not result.data:
self.LogWarning("Could not export block device %s from node %s to"
" node %s", dev.logical_id[1], src_node,
dst_node.name)
self.LogWarning("Could not export disk/%d from node %s to"
" node %s", idx, src_node, dst_node.name)
msg = self.rpc.call_blockdev_remove(src_node, dev).RemoteFailMsg()
if msg:
self.LogWarning("Could not remove snapshot block device %s from node"
" %s: %s", dev.logical_id[1], src_node, msg)
self.LogWarning("Could not remove snapshot for disk/%d from node"
" %s: %s", idx, src_node, msg)
result = self.rpc.call_finalize_export(dst_node.name, instance, snap_disks)
if result.failed or not result.data:
......
......@@ -959,7 +959,10 @@ class RpcRunner(object):
"""
flat_disks = []
for disk in snap_disks:
flat_disks.append(disk.ToDict())
if isinstance(disk, bool):
flat_disks.append(disk)
else:
flat_disks.append(disk.ToDict())
return self._SingleNodeCall(node, "finalize_export",
[self._InstDict(instance), flat_disks])
......
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