From fac30cead6893b68085b6896d4db2a4f8ae43363 Mon Sep 17 00:00:00 2001 From: Faidon Liambotis <faidon@noc.grnet.gr> Date: Fri, 16 Sep 2011 15:58:41 +0300 Subject: [PATCH] Fix OS creation's error handling when pausing sync Commit 41e1e79 introduced a feature in which when wait_for_sync is not set, DRBD sync is paused during the OS installation. Doing so, however, broke OS creation's error handling: the result value from the instance_os_add RPC call was overwritten by the one of the blockdev_pause_resume_sync call before there was a chance for it to be raised and thus masking possible errors in the OS creation. Note that the wipe method, from which the pause technique was inspired, does not suffer from this bug. Signed-off-by: Faidon Liambotis <faidon@noc.grnet.gr> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/cmdlib.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 05071be48..4f33e5f18 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -8967,8 +8967,9 @@ class LUInstanceCreate(LogicalUnit): feedback_fn("* running the instance OS create scripts...") # FIXME: pass debug option from opcode to backend - result = self.rpc.call_instance_os_add(pnode_name, iobj, False, - self.op.debug_level) + os_add_result = \ + self.rpc.call_instance_os_add(pnode_name, iobj, False, + self.op.debug_level) if pause_sync: feedback_fn("* resuming disk sync") result = self.rpc.call_blockdev_pause_resume_sync(pnode_name, @@ -8978,8 +8979,8 @@ class LUInstanceCreate(LogicalUnit): logging.warn("resume-sync of instance %s for disk %d failed", instance, idx) - result.Raise("Could not add os for instance %s" - " on node %s" % (instance, pnode_name)) + os_add_result.Raise("Could not add os for instance %s" + " on node %s" % (instance, pnode_name)) elif self.op.mode == constants.INSTANCE_IMPORT: feedback_fn("* running the instance OS import scripts...") -- GitLab