ia64/xen-unstable

changeset 7975:14886c68f254

Catch parsing errors in xm create.
author xenrtd@shispar-rt.testdev.hq.xensource.com
date Mon Nov 21 18:52:40 2005 +0100 (2005-11-21)
parents 11a06dd44a8d
children b2364dc83d1f
files tools/python/xen/xm/create.py tools/python/xen/xm/help.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Mon Nov 21 18:47:31 2005 +0100
     1.2 +++ b/tools/python/xen/xm/create.py	Mon Nov 21 18:52:40 2005 +0100
     1.3 @@ -909,7 +909,10 @@ def parseCommandLine(argv):
     1.4  
     1.5  
     1.6  def main(argv):
     1.7 -    (opts, config) = parseCommandLine(argv)
     1.8 +    try:
     1.9 +        (opts, config) = parseCommandLine(argv)
    1.10 +    except StandardError, ex:
    1.11 +        err(str(ex))
    1.12  
    1.13      if not opts:
    1.14          return
    1.15 @@ -924,8 +927,7 @@ def main(argv):
    1.16          dom0_min_mem = xroot.get_dom0_min_mem()
    1.17          if dom0_min_mem != 0:
    1.18              if balloon_out(dom0_min_mem, opts):
    1.19 -                print >>sys.stderr, "error: cannot allocate enough memory for domain"
    1.20 -                sys.exit(1)
    1.21 +                err("cannot allocate enough memory for domain")
    1.22  
    1.23          dom = make_domain(opts, config)
    1.24          if opts.vals.console_autoconnect:
     2.1 --- a/tools/python/xen/xm/help.py	Mon Nov 21 18:47:31 2005 +0100
     2.2 +++ b/tools/python/xen/xm/help.py	Mon Nov 21 18:52:40 2005 +0100
     2.3 @@ -87,7 +87,10 @@ class Var:
     2.4          """Execute the check and set the variable to the new value.
     2.5          """
     2.6          if not self.check: return
     2.7 -        env[self.name] = self.check(self.name, env.get(self.name))
     2.8 +        try: 
     2.9 +            env[self.name] = self.check(self.name, env.get(self.name))
    2.10 +        except StandardError, ex:
    2.11 +            raise sys.exc_type, self.name + " - " + str(ex)
    2.12  
    2.13      def doHelp(self, out):
    2.14          """Print help for the variable.