ia64/xen-unstable

changeset 17530:1c6008fc4d9a

xm: Add a new option to xm dump-core

The option is -R|--reset. A guest domain is reset after saving
a core dump of the guest domain when specified the option.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Apr 25 13:40:39 2008 +0100 (2008-04-25)
parents ffa511df6c23
children 18727843db60
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Fri Apr 25 13:40:05 2008 +0100
     1.2 +++ b/tools/python/xen/xm/main.py	Fri Apr 25 13:40:39 2008 +0100
     1.3 @@ -133,7 +133,7 @@ SUBCOMMAND_HELP = {
     1.4                       'Read and/or clear Xend\'s message buffer.'),
     1.5      'domid'       : ('<DomainName>', 'Convert a domain name to domain id.'),
     1.6      'domname'     : ('<DomId>', 'Convert a domain id to domain name.'),
     1.7 -    'dump-core'   : ('[-L|--live] [-C|--crash] <Domain> [Filename]',
     1.8 +    'dump-core'   : ('[-L|--live] [-C|--crash] [-R|--reset] <Domain> [Filename]',
     1.9                       'Dump core for a specific domain.'),
    1.10      'info'        : ('[-c|--config]', 'Get information about Xen host.'),
    1.11      'log'         : ('', 'Print Xend log'),
    1.12 @@ -243,6 +243,7 @@ SUBCOMMAND_OPTIONS = {
    1.13      'dump-core': (
    1.14         ('-L', '--live', 'Dump core without pausing the domain'),
    1.15         ('-C', '--crash', 'Crash domain after dumping core'),
    1.16 +       ('-R', '--reset', 'Reset domain after dumping core'),
    1.17      ),
    1.18      'start': (
    1.19         ('-p', '--paused', 'Do not unpause domain after starting it'),
    1.20 @@ -1280,14 +1281,19 @@ def xm_unpause(args):
    1.21  def xm_dump_core(args):
    1.22      live = False
    1.23      crash = False
    1.24 +    reset = False
    1.25      try:
    1.26 -        (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash'])
    1.27 +        (options, params) = getopt.gnu_getopt(args, 'LCR', ['live', 'crash', 'reset'])
    1.28          for (k, v) in options:
    1.29              if k in ('-L', '--live'):
    1.30                  live = True
    1.31 -            if k in ('-C', '--crash'):
    1.32 +            elif k in ('-C', '--crash'):
    1.33                  crash = True
    1.34 +            elif k in ('-R', '--reset'):
    1.35 +                reset = True
    1.36  
    1.37 +        if crash and reset:
    1.38 +            raise OptionError("You may not specify more than one '-CR' option")
    1.39          if len(params) not in (1, 2):
    1.40              raise OptionError("Expects 1 or 2 argument(s)")
    1.41      except getopt.GetoptError, e:
    1.42 @@ -1309,8 +1315,11 @@ def xm_dump_core(args):
    1.43          if crash:
    1.44              print "Destroying domain: %s ..." % str(dom)
    1.45              server.xend.domain.destroy(dom)
    1.46 +        elif reset:
    1.47 +            print "Resetting domain: %s ..." % str(dom)
    1.48 +            server.xend.domain.reset(dom)
    1.49      finally:
    1.50 -        if not live and not crash and ds == DOM_STATE_RUNNING:
    1.51 +        if not live and not crash and not reset and ds == DOM_STATE_RUNNING:
    1.52              server.xend.domain.unpause(dom)
    1.53  
    1.54  def xm_rename(args):