From: Iustin Pop Date: Tue, 9 Jun 2009 09:35:56 +0000 (+0200) Subject: Convert snapshot_export rpc to new style X-Git-Tag: v2.1.0beta0~431^2~85 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/ba55d062da8dfb89a37afc2f13f2e689d0094829?ds=sidebyside Convert snapshot_export rpc to new style Signed-off-by: Iustin Pop Reviewed-by: Guido Trotter --- diff --git a/lib/backend.py b/lib/backend.py index f2ac504..08b65aa 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -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): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index e4e7b71..4d9502f 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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"