ia64/xen-unstable

changeset 7184:fc97109eb28e

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>
author emellor@ewan
date Mon Oct 03 16:39:19 2005 +0100 (2005-10-03)
parents 5db9a237f8ce
children d79ab87e27b8
files tools/python/xen/sv/DomInfo.py tools/python/xen/xend/XendClient.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xm/destroy.py tools/python/xen/xm/shutdown.py
line diff
     1.1 --- a/tools/python/xen/sv/DomInfo.py	Mon Oct 03 16:33:09 2005 +0100
     1.2 +++ b/tools/python/xen/sv/DomInfo.py	Mon Oct 03 16:39:19 2005 +0100
     1.3 @@ -139,7 +139,7 @@ class DomActionTab( ActionTab ):
     1.4          if not dom is None and dom != '0':
     1.5      	   if DEBUG: print ">DomShutDown %s" % dom
     1.6             try:
     1.7 -    	   	server.xend_domain_shutdown( int( dom ), "halt" )
     1.8 +    	   	server.xend_domain_shutdown( int( dom ), "poweroff" )
     1.9             except:
    1.10             	pass
    1.11      
    1.12 @@ -175,7 +175,7 @@ class DomActionTab( ActionTab ):
    1.13          if not dom is None and dom != '0':
    1.14      	   if DEBUG: print ">DomDestroy %s" % dom
    1.15             try:
    1.16 -           	server.xend_domain_destroy( int( dom ), "halt" )
    1.17 +           	server.xend_domain_destroy(int( dom ))
    1.18             except:
    1.19             	pass
    1.20  
     2.1 --- a/tools/python/xen/xend/XendClient.py	Mon Oct 03 16:33:09 2005 +0100
     2.2 +++ b/tools/python/xen/xend/XendClient.py	Mon Oct 03 16:39:19 2005 +0100
     2.3 @@ -232,10 +232,9 @@ class Xend:
     2.4                               {'op'      : 'sysrq',
     2.5                                'key'     : key})
     2.6  
     2.7 -    def xend_domain_destroy(self, id, reason):
     2.8 +    def xend_domain_destroy(self, id):
     2.9          return self.xendPost(self.domainurl(id),
    2.10 -                             {'op'      : 'destroy',
    2.11 -                              'reason'  : reason })
    2.12 +                             {'op'      : 'destroy' })
    2.13  
    2.14      def xend_domain_save(self, id, filename):
    2.15          return self.xendPost(self.domainurl(id),
     3.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Mon Oct 03 16:33:09 2005 +0100
     3.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Mon Oct 03 16:39:19 2005 +0100
     3.3 @@ -71,8 +71,7 @@ class SrvDomain(SrvDir):
     3.4  
     3.5      def op_destroy(self, op, req):
     3.6          fn = FormFn(self.xd.domain_destroy,
     3.7 -                    [['dom',    'int'],
     3.8 -                     ['reason', 'str']])
     3.9 +                    [['dom',    'int']])
    3.10          val = fn(req.args, {'dom': self.dom.domid})
    3.11          req.setHeader("Location", "%s/.." % req.prePathURL())
    3.12          return val
    3.13 @@ -232,8 +231,6 @@ class SrvDomain(SrvDir):
    3.14  
    3.15          req.write('<form method="post" action="%s">' % url)
    3.16          req.write('<input type="submit" name="op" value="destroy">')
    3.17 -        req.write('<input type="radio" name="reason" value="halt" checked>Halt')
    3.18 -        req.write('<input type="radio" name="reason" value="reboot">Reboot')
    3.19          req.write('</form>')
    3.20  
    3.21          req.write('<form method="post" action="%s">' % url)
     4.1 --- a/tools/python/xen/xm/destroy.py	Mon Oct 03 16:33:09 2005 +0100
     4.2 +++ b/tools/python/xen/xm/destroy.py	Mon Oct 03 16:39:19 2005 +0100
     4.3 @@ -21,19 +21,15 @@
     4.4  from xen.xend.XendClient import server
     4.5  from xen.xm.opts import *
     4.6  
     4.7 -gopts = Opts(use="""[options] [DOM]
     4.8 +gopts = Opts(use="""[DOM]
     4.9  
    4.10 -Destroy a domain, optionally restarting it.
    4.11 +Destroy a domain.
    4.12  """)
    4.13  
    4.14  gopts.opt('help', short='h',
    4.15           fn=set_true, default=0,
    4.16           use="Print this help.")
    4.17  
    4.18 -gopts.opt('reboot', short='R',
    4.19 -          fn=set_true, default=0,
    4.20 -          use='Destroy and restart.')
    4.21 -
    4.22  def main(argv):
    4.23      opts = gopts
    4.24      args = opts.parse(argv)
    4.25 @@ -42,10 +38,4 @@ def main(argv):
    4.26          return
    4.27      if len(args) < 1: opts.err('Missing domain')
    4.28      dom = args[0]
    4.29 -    if opts.vals.reboot:
    4.30 -        mode = 'reboot'
    4.31 -    else:
    4.32 -        mode = 'halt'
    4.33 -    server.xend_domain_destroy(dom, mode)
    4.34 -    
    4.35 -        
    4.36 +    server.xend_domain_destroy(dom)
     5.1 --- a/tools/python/xen/xm/shutdown.py	Mon Oct 03 16:33:09 2005 +0100
     5.2 +++ b/tools/python/xen/xm/shutdown.py	Mon Oct 03 16:39:19 2005 +0100
     5.3 @@ -73,19 +73,15 @@ def shutdown(opts, doms, mode, wait):
     5.4          opts.info("All domains terminated")
     5.5  
     5.6  def shutdown_mode(opts):
     5.7 -    mode = 'poweroff'
     5.8 -    if opts.vals.wait:
     5.9 -        mode = 'halt'
    5.10 -        if opts.vals.reboot:
    5.11 -           opts.err("Can't specify wait and reboot") 
    5.12 +    if opts.vals.halt and opts.vals.reboot:
    5.13 +        opts.err("Can't specify halt and reboot")
    5.14 +
    5.15 +    if opts.vals.halt:
    5.16 +        return 'halt'
    5.17 +    elif opts.vals.reboot:
    5.18 +        return 'reboot'
    5.19      else:
    5.20 -        if opts.vals.halt and opts.vals.reboot:
    5.21 -            opts.err("Can't specify halt and reboot")
    5.22 -        if opts.vals.halt:
    5.23 -            mode = 'halt'
    5.24 -        elif opts.vals.reboot:
    5.25 -            mode = 'reboot'
    5.26 -    return mode
    5.27 +        return 'poweroff'
    5.28  
    5.29  def main_all(opts, args):
    5.30      mode = shutdown_mode(opts)