Commit 7dd106d3 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix Xen soft reboot via polling

This patch fixes the Xen soft reboot ("xm reboot") via polling for a specific
time for either changed domain ID or decreased CPU run-time.

This sould prevent the race-conditions discussed on the mailing list for

Reviewed-by: imsnah
parent 5d60b3bd
......@@ -42,6 +42,8 @@ class XenHypervisor(hv_base.BaseHypervisor):
all the functionality that is identical for both.
def _WriteConfigFile(cls, instance, block_devices):
......@@ -191,12 +193,29 @@ class XenHypervisor(hv_base.BaseHypervisor):
"""Reboot an instance.
ini_info = self.GetInstanceInfo(
result = utils.RunCmd(["xm", "reboot",])
if result.failed:
raise errors.HypervisorError("Failed to reboot instance %s: %s, %s" %
(, result.fail_reason,
done = False
retries = self.REBOOT_RETRY_COUNT
while retries > 0:
new_info = self.GetInstanceInfo(
# check if the domain ID has changed or the run time has
# decreased
if new_info[1] != ini_info[1] or new_info[5] < ini_info[5]:
done = True
retries -= 1
if not done:
raise errors.HypervisorError("Failed to reboot instance %s: instance"
" did not reboot in the expected interval" %
(, ))
def GetNodeInfo(self):
"""Return information about the 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