aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-02-07 09:27:46 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-02-07 09:27:46 +0000
commitc5b5f2e9ffe06cb9d967a0e7842df89e00f17818 (patch)
treef53a11b361330bf6376c043eb936deea4c9cab93 /tools
parent47ea4d5c24b977228a1465d1c6af8206e0e360d4 (diff)
downloadxen-c5b5f2e9ffe06cb9d967a0e7842df89e00f17818.tar.gz
xen-c5b5f2e9ffe06cb9d967a0e7842df89e00f17818.tar.bz2
xen-c5b5f2e9ffe06cb9d967a0e7842df89e00f17818.zip
xm reboot: Fix wait option of xm reboot command
When I rebooted a domain by xm reboot command with wait option, I saw the following message. But, rebooting the domain succeeded. Domain vm1 destroyed for failed in rebooting The cause why the message was shown is the domain is destroyed temporarily by processing of xm reboot command. The domain information is not gotten from Xend by server.xend.domains() function till recreating the domain is completed. This patch fixes processing of xm reboot command in Xm side. It waits just a bit till recreating the domain is completed, then it measures the success or failure of the reboot of the domain. Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xm/shutdown.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/python/xen/xm/shutdown.py b/tools/python/xen/xm/shutdown.py
index 8284a73bca..6903183e9a 100644
--- a/tools/python/xen/xm/shutdown.py
+++ b/tools/python/xen/xm/shutdown.py
@@ -24,6 +24,8 @@ from opts import *
from main import server, serverType, SERVER_XEN_API, get_single_vm
from xen.xend.XendAPIConstants import *
+RECREATING_TIMEOUT = 30
+
gopts = Opts(use="""[options] [DOM]
Shutdown one or more domains gracefully.
@@ -53,6 +55,7 @@ def wait_reboot(opts, doms, rcs):
if serverType == SERVER_XEN_API:
opts.err("Cannot wait for reboot w/ XenAPI (yet)")
+ recreating = {}
while doms:
alive = server.xend.domains(0)
reboot = []
@@ -61,9 +64,17 @@ def wait_reboot(opts, doms, rcs):
rc = server.xend.domain.getRestartCount(d)
if rc == rcs[d]: continue
reboot.append(d)
+
+ # Probably the domain is being recreated now.
+ # We have to wait just a bit for recreating the domain.
+ elif not recreating.has_key(d):
+ recreating[d] = 0
else:
- opts.info("Domain %s destroyed for failed in rebooting" % d)
- doms.remove(d)
+ recreating[d] += 1
+ if recreating[d] > RECREATING_TIMEOUT:
+ opts.info("Domain %s destroyed for failing to reboot" % d)
+ doms.remove(d)
+
for d in reboot:
opts.info("Domain %s rebooted" % d)
doms.remove(d)