From ae48ac3256ef0cf5a0bf210cbf0343358b8f602d Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 16 Feb 2009 14:50:30 +0000 Subject: [PATCH] Fix some bugs in reboot There are two issues fixed in this patch: - first, the recent RPC changes caused loss of data in hard reboot type; we weren't reporting any results from the stop/start instance calls; - second, in soft or hard reboots, we didn't initialized the disk physical ID; based on the last state of the instance's disks, this can create a failure in identifying the disks After this patch, burnin works again with reboot, and reports errors correctly. Reviewed-by: imsnah --- lib/backend.py | 6 ++++-- lib/cmdlib.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index c1723004c..830607ed6 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -977,8 +977,10 @@ def InstanceReboot(instance, reboot_type, extra_args): return (False, msg) elif reboot_type == constants.INSTANCE_REBOOT_HARD: try: - InstanceShutdown(instance) - StartInstance(instance, extra_args) + stop_result = InstanceShutdown(instance) + if not stop_result[0]: + return stop_result + return StartInstance(instance, extra_args) except errors.HypervisorError, err: msg = "Failed to hard reboot instance %s: %s" % (instance.name, err) logging.error(msg) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 8347140b8..c2f2c9386 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2795,6 +2795,8 @@ class LURebootInstance(LogicalUnit): if reboot_type in [constants.INSTANCE_REBOOT_SOFT, constants.INSTANCE_REBOOT_HARD]: + for disk in instance.disks: + self.cfg.SetDiskID(disk, node_current) result = self.rpc.call_instance_reboot(node_current, instance, reboot_type, extra_args) msg = result.RemoteFailMsg() -- GitLab