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

Convert snapshot_export rpc to new style


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 87812fd3
......@@ -1780,8 +1780,8 @@ def ExportSnapshot(disk, dest_node, instance, cluster_name, idx):
os.mkdir(constants.LOG_OS_DIR, 0750)
real_disk = _RecursiveFindBD(disk)
if real_disk is None:
raise errors.BlockDeviceError("Block device '%s' is not set up" %
str(disk))
_Fail("Block device '%s' is not set up", disk)
real_disk.Open()
export_env['EXPORT_DEVICE'] = real_disk.dev_path
......@@ -1810,11 +1810,10 @@ def ExportSnapshot(disk, dest_node, instance, cluster_name, idx):
result = utils.RunCmd(command, env=export_env)
if result.failed:
logging.error("os snapshot export command '%s' returned error: %s"
" output: %s", command, result.fail_reason, result.output)
return False
_Fail("OS snapshot export command '%s' returned error: %s"
" output: %s", command, result.fail_reason, result.output)
return True
return (True, None)
def FinalizeExport(instance, snap_disks):
......
......@@ -6491,10 +6491,11 @@ class LUExportInstance(LogicalUnit):
if dev:
result = self.rpc.call_snapshot_export(src_node, dev, dst_node.name,
instance, cluster_name, idx)
if result.failed or not result.data:
msg = result.RemoteFailMsg()
if msg:
self.LogWarning("Could not export block device %s from node %s to"
" node %s", dev.logical_id[1], src_node,
dst_node.name)
" node %s: %s", dev.logical_id[1], src_node,
dst_node.name, msg)
msg = self.rpc.call_blockdev_remove(src_node, dev).RemoteFailMsg()
if msg:
self.LogWarning("Could not remove snapshot block device %s from node"
......
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