ia64/xen-unstable

changeset 2798:7aa5dc139305

bitkeeper revision 1.1159.1.315 (41857fdeXcTRTZARibSHQW4l1prQyw)

Minor tweaks to xm dmesg.
author mwilli2@anvil.research
date Mon Nov 01 00:14:22 2004 +0000 (2004-11-01)
parents 209dc445dc31
children 3f929065a1d1
files BitKeeper/etc/logging_ok tools/python/xen/xend/server/SrvDmesg.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Sun Oct 31 01:41:52 2004 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Mon Nov 01 00:14:22 2004 +0000
     1.3 @@ -35,6 +35,7 @@ mafetter@fleming.research
     1.4  mark@maw48.kings.cam.ac.uk
     1.5  maw48@labyrinth.cl.cam.ac.uk
     1.6  mjw@wray-m-3.hpl.hp.com
     1.7 +mwilli2@anvil.research
     1.8  mwilli2@equilibrium.research
     1.9  mwilli2@equilibrium.research.intel-research.net
    1.10  rac61@labyrinth.cl.cam.ac.uk
     2.1 --- a/tools/python/xen/xend/server/SrvDmesg.py	Sun Oct 31 01:41:52 2004 +0000
     2.2 +++ b/tools/python/xen/xend/server/SrvDmesg.py	Mon Nov 01 00:14:22 2004 +0000
     2.3 @@ -36,5 +36,6 @@ class SrvDmesg(SrvDir):
     2.4      def info(self):
     2.5          return self.xd.info()
     2.6  
     2.7 -    def op_clear(self):
     2.8 +    def op_clear(self, op, req):
     2.9          self.xd.clear()
    2.10 +        return 0
     3.1 --- a/tools/python/xen/xm/main.py	Sun Oct 31 01:41:52 2004 +0000
     3.2 +++ b/tools/python/xen/xm/main.py	Mon Nov 01 00:14:22 2004 +0000
     3.3 @@ -12,6 +12,7 @@ from xen.xend import sxp
     3.4  from xen.xend.XendClient import XendError, server
     3.5  from xen.xend.XendClient import main as xend_client_main
     3.6  from xen.xm import create, destroy, migrate, shutdown
     3.7 +from xen.xm.opts import *
     3.8  
     3.9  class Group:
    3.10  
    3.11 @@ -662,15 +663,34 @@ xm.prog(ProgCall)
    3.12  class ProgDmesg(Prog):
    3.13      group = 'host'
    3.14      name  =  "dmesg"
    3.15 -    info  = """Print Xen boot output."""
    3.16 +    info  = """Read or clear Xen's message buffer."""
    3.17 +
    3.18 +    gopts = Opts(use="""[-c|--clear]
    3.19 +
    3.20 +Read Xen's message buffer (boot output, warning and error messages) or clear
    3.21 +its contents if the [-c|--clear] flag is specified.
    3.22 +""")
    3.23 +
    3.24 +    gopts.opt('clear', short='c',
    3.25 +              fn=set_true, default=0,
    3.26 +              use="Clear the contents of the Xen message buffer.")
    3.27 +
    3.28 +    short_options = ['-c']
    3.29 +    long_options = ['--clear']
    3.30 +
    3.31 +    def help(self, args):
    3.32 +        self.gopts.argv = args
    3.33 +        self.gopts.usage()
    3.34  
    3.35      def main(self, args):
    3.36 -        if len(args) == 1:
    3.37 -            print server.xend_node_dmesg(clear)
    3.38 -        if len(args) > 1:
    3.39 -            if len(args) == 2 and args[1] == '-c':
    3.40 -                print server.xend_node_clear_dmesg()
    3.41 -            else: self.err("%s: Invalid argument" % args[0])
    3.42 +        self.gopts.parse(args)
    3.43 +        if not (1 <= len(args) <=2):
    3.44 +            self.gopts.err('Invalid arguments: ' + str(args))
    3.45 +
    3.46 +        if not self.gopts.vals.clear:
    3.47 +            print server.xend_node_get_dmesg()
    3.48 +        else:
    3.49 +            server.xend_node_clear_dmesg()
    3.50  
    3.51  xm.prog(ProgDmesg)
    3.52