Fix behavior of xm shutdown/reboot command for Domain-0
PATCH 1/1 Fix behavior of xm shutdown/reboot command for Domain-0
Hi,
This patch fixes behavior of xm shutdown/reboot command for Domain-0.
Quoted 1 line
From wrong operation, we can prevent a system down with it.
Without this patch you see:
# xm shutdown Domain-0 # Broadcast message from root (Fri Nov 17 19:13:24 2006):
The system is going down for system halt NOW!
# xm reboot 0 # Broadcast message from root (console) (Fri Nov 17 21:26:08 2006):
The system is going down for reboot NOW!
With this patch applied:
# xm shutdown 0 Error: Cannot shutdown and reboot privileged domain Domain-0 Usage: xm shutdown <Domain> [-waRH]
Shutdown a domain.
# xm reboot Domain-0 Error: Cannot shutdown and reboot privileged domain Domain-0 Usage: xm reboot <Domain> [-wa]
Reboot a domain.
Signed-off-by Masaki Kanno <[email protected]>
Best regards,
Kan
tools/python/xen/xend/XendDomainInfo.py +4 -0
@@ -51,6 +51,7 @@ from xen.xend.XendAPIConstants import * from xen.xend.XendAPIConstants import * MIGRATE_TIMEOUT = 30.0 +DOM0_ID = 0 xc = xen.lowlevel.xc.xc() xroot = XendRoot.instance()
@@ -473,6 +474,9 @@ class XendDomainInfo: def shutdown(self, reason): """Shutdown a domain by signalling this via xenstored.""" log.debug('XendDomainInfo.shutdown') + if self.domid == DOM0_ID: + raise XendError("Cannot shutdown and reboot " + + "privileged domain %s" % self.info['name']) if self.state in (DOM_STATE_SHUTDOWN, DOM_STATE_HALTED,): raise XendError('Domain cannot be shutdown')
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel