ia64/xen-unstable

changeset 1566:f8a6be024808

bitkeeper revision 1.1011.1.3 (40daed4ekjtnj7suF3c9KgnpbGgCQw)

XM fixes
author kaf24@scramble.cl.cam.ac.uk
date Thu Jun 24 15:03:42 2004 +0000 (2004-06-24)
parents f027c0742a03
children 815e840634fb 9078dae95f8b
files tools/xenmgr/lib/xm/main.py tools/xenmgr/lib/xm/shutdown.py
line diff
     1.1 --- a/tools/xenmgr/lib/xm/main.py	Thu Jun 24 14:42:34 2004 +0000
     1.2 +++ b/tools/xenmgr/lib/xm/main.py	Thu Jun 24 15:03:42 2004 +0000
     1.3 @@ -159,12 +159,12 @@ class ProgSave(Prog):
     1.4      info = """Save domain state (and config) to file."""
     1.5  
     1.6      def help(self, args):
     1.7 -        print args[0], "DOM FILE [CONFIG]"
     1.8 +        print self.name, "DOM FILE [CONFIG]"
     1.9          print """\nSave domain with id DOM to FILE.
    1.10          Optionally save config to CONFIG."""
    1.11          
    1.12      def main(self, args):
    1.13 -        if len(args) < 3: self.err("%s: Missing arguments" % args[0])
    1.14 +        if len(args) < 3: self.err("%s: Missing arguments" % self.name)
    1.15          dom = args[1]
    1.16          savefile = os.path.abspath(args[2])
    1.17          configfile = None
    1.18 @@ -185,11 +185,11 @@ class ProgRestore(Prog):
    1.19      info = """Create a domain from a saved state."""
    1.20  
    1.21      def help(self, args):
    1.22 -        print args[0], "FILE CONFIG"
    1.23 +        print self.name, "FILE CONFIG"
    1.24          print "\nRestore a domain from FILE using configuration CONFIG."
    1.25      
    1.26      def main(self, help, args):
    1.27 -        if len(args) < 3: self.err("%s: Missing arguments" % args[0])
    1.28 +        if len(args) < 3: self.err("%s: Missing arguments" % self.name)
    1.29          savefile =  os.path.abspath(args[1])
    1.30          configfile = os.path.abspath(args[2])
    1.31          info = server.xend_domain_restore(savefile, configfile)
    1.32 @@ -204,7 +204,7 @@ class ProgList(Prog):
    1.33  
    1.34      def help(self, args):
    1.35          if help:
    1.36 -            print args[0], '[DOM...]'
    1.37 +            print self.name, '[DOM...]'
    1.38              print """\nGet information about domains.
    1.39              Either all domains or the domains given."""
    1.40              return
    1.41 @@ -236,11 +236,11 @@ class ProgDestroy(Prog):
    1.42      info = """Terminate a domain immediately."""
    1.43  
    1.44      def help(self, args):
    1.45 -        print args[0], 'DOM'
    1.46 +        print self.name, 'DOM'
    1.47          print '\nTerminate domain DOM immediately.'
    1.48  
    1.49      def main(self, args):
    1.50 -        if len(args) < 2: self.err("%s: Missing domain" % args[0])
    1.51 +        if len(args) < 2: self.err("%s: Missing domain" % self.name)
    1.52          dom = args[1]
    1.53          server.xend_domain_destroy(dom)
    1.54  
    1.55 @@ -252,7 +252,7 @@ class ProgShutdown(Prog):
    1.56      info = """Shutdown a domain."""
    1.57  
    1.58      def help(self, args):
    1.59 -        print args[0], 'DOM'
    1.60 +        print self.name, 'DOM'
    1.61          print '\nSignal domain DOM to shutdown.'
    1.62      
    1.63      def main(self, args):
    1.64 @@ -266,11 +266,11 @@ class ProgPause(Prog):
    1.65      info = """Pause execution of a domain."""
    1.66  
    1.67      def help(self, args):
    1.68 -        print args[0], 'DOM'
    1.69 +        print self.name, 'DOM'
    1.70          print '\nPause execution of domain DOM.'
    1.71  
    1.72      def main(self, args):
    1.73 -        if len(args) < 2: self.err("%s: Missing domain" % args[0])
    1.74 +        if len(args) < 2: self.err("%s: Missing domain" % self.name)
    1.75          dom = args[1]
    1.76          server.xend_domain_pause(dom)
    1.77  
    1.78 @@ -282,11 +282,11 @@ class ProgUnpause(Prog):
    1.79      info = """Unpause a paused domain."""
    1.80  
    1.81      def help(self, args):
    1.82 -        print args[0], 'DOM'
    1.83 +        print self.name, 'DOM'
    1.84          print '\nUnpause execution of domain DOM.'
    1.85  
    1.86      def main(self, args):
    1.87 -        if len(args) < 2: self.err("%s: Missing domain" % args[0])
    1.88 +        if len(args) < 2: self.err("%s: Missing domain" % self.name)
    1.89          dom = args[1]
    1.90          server.xend_domain_unpause(dom)
    1.91  
    1.92 @@ -298,11 +298,11 @@ class ProgPincpu(Prog):
    1.93      info = """Pin a domain to a cpu. """
    1.94  
    1.95      def help(self, args):
    1.96 -        print args[0],'DOM CPU'
    1.97 +        print self.name,'DOM CPU'
    1.98          print '\nPin domain DOM to cpu CPU.'
    1.99  
   1.100      def main(self, args):
   1.101 -        if len(args) != 3: self.err("%s: Invalid argument(s)" % args[0])
   1.102 +        if len(args) != 3: self.err("%s: Invalid argument(s)" % self.name)
   1.103          v = map(int, args[1:3])
   1.104          server.xend_domain_pincpu(*v)
   1.105  
   1.106 @@ -314,11 +314,11 @@ class ProgBvt(Prog):
   1.107      info = """Set BVT scheduler parameters."""
   1.108      
   1.109      def help(self, args):
   1.110 -        print args[0], "DOM MCUADV WARP WARPL WARPU"
   1.111 +        print self.name, "DOM MCUADV WARP WARPL WARPU"
   1.112          print '\nSet Borrowed Virtual Time scheduler parameters.'
   1.113  
   1.114      def main(self, args):
   1.115 -        if len(args) != 6: self.err("%s: Invalid argument(s)" % args[0])
   1.116 +        if len(args) != 6: self.err("%s: Invalid argument(s)" % self.name)
   1.117          v = map(int, args[1:6])
   1.118          server.xend_domain_cpu_bvt_set(*v)
   1.119  
   1.120 @@ -330,11 +330,11 @@ class ProgBvtslice(Prog):
   1.121      info = """Set the BVT scheduler slice."""
   1.122  
   1.123      def help(self, args):
   1.124 -        print args[0], 'SLICE'
   1.125 +        print self.name, 'SLICE'
   1.126          print '\nSet Borrowed Virtual Time scheduler slice.'
   1.127  
   1.128      def main(self, args):
   1.129 -        if len(args) < 2: self.err('%s: Missing slice' % args[0])
   1.130 +        if len(args) < 2: self.err('%s: Missing slice' % self.name)
   1.131          server.xend_node_cpu_bvt_slice_set(slice)
   1.132  
   1.133  xm.prog(ProgBvtslice)
   1.134 @@ -345,11 +345,11 @@ class ProgAtropos(Prog):
   1.135      info = """Set atropos parameters."""
   1.136  
   1.137      def help(self, args):
   1.138 -        print args[0], "DOM PERIOD SLICE LATENCY XTRATIME"
   1.139 +        print self.name, "DOM PERIOD SLICE LATENCY XTRATIME"
   1.140          print "\nSet atropos parameters."
   1.141  
   1.142      def main(self, args):
   1.143 -        if len(args) != 5: self.err("%s: Invalid argument(s)" % args[0])
   1.144 +        if len(args) != 5: self.err("%s: Invalid argument(s)" % self.name)
   1.145          v = map(int, args[1:5])
   1.146          server.xend_domain_cpu_atropos_set(*v)
   1.147  
   1.148 @@ -361,11 +361,11 @@ class ProgRrobin(Prog):
   1.149      info = """Set round robin slice."""
   1.150  
   1.151      def help(self, args):
   1.152 -        print args[0], "SLICE"
   1.153 +        print self.name, "SLICE"
   1.154          print "\nSet round robin scheduler slice."
   1.155  
   1.156      def main(self, args):
   1.157 -        if len(args) != 2: self.err("%s: Invalid argument(s)" % args[0])
   1.158 +        if len(args) != 2: self.err("%s: Invalid argument(s)" % self.name)
   1.159          rrslice = int(args[1])
   1.160          server.xend_node_rrobin_set(rrslice)
   1.161  
   1.162 @@ -407,11 +407,11 @@ class ProgConsole(Prog):
   1.163      info = """Open a console to a domain."""
   1.164      
   1.165      def help(self, args):
   1.166 -        print "console DOM"
   1.167 +        print self.name, "DOM"
   1.168          print "\nOpen a console to domain DOM."
   1.169  
   1.170      def main(self, args):
   1.171 -        if len(args) < 2: self.err("%s: Missing domain" % args[0])
   1.172 +        if len(args) < 2: self.err("%s: Missing domain" % self.name)
   1.173          dom = args[1]
   1.174          info = server.xend_domain(dom)
   1.175          console = sxp.child(info, "console")
     2.1 --- a/tools/xenmgr/lib/xm/shutdown.py	Thu Jun 24 14:42:34 2004 +0000
     2.2 +++ b/tools/xenmgr/lib/xm/shutdown.py	Thu Jun 24 15:03:42 2004 +0000
     2.3 @@ -46,7 +46,7 @@ def shutdown(opts, doms, wait):
     2.4          opts.info("All domains terminated")
     2.5  
     2.6  def main_all(opts, args):
     2.7 -    shutdown(opts, None, opts.wait)
     2.8 +    shutdown(opts, None, opts.vals.wait)
     2.9  
    2.10  def main_dom(opts, args):
    2.11      if len(args) < 1: opts.err('Missing domain')
    2.12 @@ -55,16 +55,16 @@ def main_dom(opts, args):
    2.13          domid = int(dom)
    2.14      except:
    2.15          opts.err('Invalid domain: ' + dom)
    2.16 -    shutdown(opts, [ domid ], opts.wait)
    2.17 +    shutdown(opts, [ domid ], opts.vals.wait)
    2.18      
    2.19  def main(argv):
    2.20      opts = gopts
    2.21      args = opts.parse(argv)
    2.22 -    if opts.help:
    2.23 +    if opts.vals.help:
    2.24          opts.usage()
    2.25          return
    2.26      print 'shutdown.main>', len(args), args
    2.27 -    if opts.all:
    2.28 +    if opts.vals.all:
    2.29          main_all(opts, args)
    2.30      else:
    2.31          main_dom(opts, args)