This patch changes the shutdown driver and xend to use strings instead

of codes for signaling a shutdown request.

Also, we fix the return code for the shutdown notifier, so other
notifiers will get to run ;)

Signed-off-by: Dan Smith <danms@us.ibm.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-08-06 09:48:47 +00:00
1 parent 18a62c66f0
commit 32060bbf97
2 files changed
+26 -23

No files matched your search

+2 -11
View File
@@ -52,14 +52,6 @@ shutdown_reasons = {
DOMAIN_CRASH : "crash",
}
"""Map shutdown reasons to codes
"""
shutdown_codes = {
'poweroff' : DOMAIN_POWEROFF,
'reboot' : DOMAIN_REBOOT,
'suspend' : DOMAIN_SUSPEND,
}
RESTART_ALWAYS = 'always'
RESTART_ONREBOOT = 'onreboot'
RESTART_NEVER = 'never'
@@ -939,11 +931,10 @@ class XendDomainInfo:
self.channel.writeRequest(msg)
def shutdown(self, reason):
reasonid = shutdown_codes.get(reason)
if reasonid == None:
if not reason in shutdown_reasons.values():
raise XendError('invalid reason:' + reason)
db = self.db.addChild("/control");
db['shutdown'] = '%i' % reasonid;
db['shutdown'] = reason;
db.saveDB(save=True);
if not reason in ['suspend']:
self.shutdown_pending = {'start':time.time(), 'reason':reason}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.