[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEND] Better checking of shutdown of domain0.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID 98ee83ed9d286e5ac49e445aa7fe73f224ffa756 # Parent affe80cdb4857b52a0f7bb1eb36c28977f270eae [XEND] Better checking of shutdown of domain0. Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx> --- tools/python/xen/xend/XendDomainInfo.py | 2 ++ tools/python/xen/xm/shutdown.py | 15 ++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff -r affe80cdb485 -r 98ee83ed9d28 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Fri Jul 28 17:33:26 2006 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Jul 28 17:35:39 2006 +0100 @@ -943,6 +943,8 @@ class XendDomainInfo: def shutdown(self, reason): if not reason in shutdown_reasons.values(): raise XendError('Invalid reason: %s' % reason) + if self.domid == 0: + raise XendError("Can't specify Domain-0") self.storeDom("control/shutdown", reason) diff -r affe80cdb485 -r 98ee83ed9d28 tools/python/xen/xm/shutdown.py --- a/tools/python/xen/xm/shutdown.py Fri Jul 28 17:33:26 2006 +0100 +++ b/tools/python/xen/xm/shutdown.py Fri Jul 28 17:35:39 2006 +0100 @@ -22,8 +22,6 @@ from xen.xend.XendClient import server from xen.xend.XendClient import server from xen.xend import sxp from xen.xm.opts import * - -DOM0_ID = '0' gopts = Opts(use="""[options] [DOM] @@ -51,14 +49,6 @@ gopts.opt('reboot', short='R', use='Shutdown and reboot.') def shutdown(opts, doms, mode, wait): - if doms == None: doms = server.xend.domains(0) - dom0_name = sxp.child_value(server.xend.domain(0), 'name') - for x in [dom0_name, DOM0_ID]: - if x in doms: - if opts.vals.all: - doms.remove(x) - else: - opts.err("Can't specify Domain-0") for d in doms: server.xend.domain.shutdown(d, mode) if wait: @@ -86,8 +76,11 @@ def shutdown_mode(opts): return 'poweroff' def main_all(opts, args): + doms = server.xend.domains(0) + dom0_name = sxp.child_value(server.xend.domain(0), 'name') + doms.remove(dom0_name) mode = shutdown_mode(opts) - shutdown(opts, None, mode, opts.vals.wait) + shutdown(opts, doms, mode, opts.vals.wait) def main_dom(opts, args): if len(args) == 0: opts.err('No domain parameter given') _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |