mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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:
1 parent
18a62c66f0
commit
32060bbf97
2 files changed
+26
-23
No files matched your search
@@ -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}
|
||||
|
||||