mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Remove the reason code from the destroy action -- the reason is only of value
on a graceful shutdown. Clarify the semantic difference between poweroff and halt (we use halt to mean 'shutdown and stop' and poweroff to mean 'shutdown and do whatever the configured behaviour is'). Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
1 parent
f020dc6069
commit
b379670db6
2 files changed
+11
-25
No files matched your search
@@ -21,19 +21,15 @@
|
||||
from xen.xend.XendClient import server
|
||||
from xen.xm.opts import *
|
||||
|
||||
gopts = Opts(use="""[options] [DOM]
|
||||
gopts = Opts(use="""[DOM]
|
||||
|
||||
Destroy a domain, optionally restarting it.
|
||||
Destroy a domain.
|
||||
""")
|
||||
|
||||
gopts.opt('help', short='h',
|
||||
fn=set_true, default=0,
|
||||
use="Print this help.")
|
||||
|
||||
gopts.opt('reboot', short='R',
|
||||
fn=set_true, default=0,
|
||||
use='Destroy and restart.')
|
||||
|
||||
def main(argv):
|
||||
opts = gopts
|
||||
args = opts.parse(argv)
|
||||
@@ -42,10 +38,4 @@ def main(argv):
|
||||
return
|
||||
if len(args) < 1: opts.err('Missing domain')
|
||||
dom = args[0]
|
||||
if opts.vals.reboot:
|
||||
mode = 'reboot'
|
||||
else:
|
||||
mode = 'halt'
|
||||
server.xend_domain_destroy(dom, mode)
|
||||
|
||||
|
||||
server.xend_domain_destroy(dom)
|
||||
@@ -73,19 +73,15 @@ def shutdown(opts, doms, mode, wait):
|
||||
opts.info("All domains terminated")
|
||||
|
||||
def shutdown_mode(opts):
|
||||
mode = 'poweroff'
|
||||
if opts.vals.wait:
|
||||
mode = 'halt'
|
||||
if opts.vals.reboot:
|
||||
opts.err("Can't specify wait and reboot")
|
||||
if opts.vals.halt and opts.vals.reboot:
|
||||
opts.err("Can't specify halt and reboot")
|
||||
|
||||
if opts.vals.halt:
|
||||
return 'halt'
|
||||
elif opts.vals.reboot:
|
||||
return 'reboot'
|
||||
else:
|
||||
if opts.vals.halt and opts.vals.reboot:
|
||||
opts.err("Can't specify halt and reboot")
|
||||
if opts.vals.halt:
|
||||
mode = 'halt'
|
||||
elif opts.vals.reboot:
|
||||
mode = 'reboot'
|
||||
return mode
|
||||
return 'poweroff'
|
||||
|
||||
def main_all(opts, args):
|
||||
mode = shutdown_mode(opts)
|
||||
|
||||