[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Catch parsing errors in xm create.



# HG changeset patch
# User xenrtd@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 14886c68f254feb2452f6c7233100afde4e37d33
# Parent  11a06dd44a8d5fd8aa503adf8120329085741b07
Catch parsing errors in xm create.

diff -r 11a06dd44a8d -r 14886c68f254 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Mon Nov 21 17:47:31 2005
+++ b/tools/python/xen/xm/create.py     Mon Nov 21 17:52:40 2005
@@ -909,7 +909,10 @@
 
 
 def main(argv):
-    (opts, config) = parseCommandLine(argv)
+    try:
+        (opts, config) = parseCommandLine(argv)
+    except StandardError, ex:
+        err(str(ex))
 
     if not opts:
         return
@@ -924,8 +927,7 @@
         dom0_min_mem = xroot.get_dom0_min_mem()
         if dom0_min_mem != 0:
             if balloon_out(dom0_min_mem, opts):
-                print >>sys.stderr, "error: cannot allocate enough memory for 
domain"
-                sys.exit(1)
+                err("cannot allocate enough memory for domain")
 
         dom = make_domain(opts, config)
         if opts.vals.console_autoconnect:
diff -r 11a06dd44a8d -r 14886c68f254 tools/python/xen/xm/help.py
--- a/tools/python/xen/xm/help.py       Mon Nov 21 17:47:31 2005
+++ b/tools/python/xen/xm/help.py       Mon Nov 21 17:52:40 2005
@@ -87,7 +87,10 @@
         """Execute the check and set the variable to the new value.
         """
         if not self.check: return
-        env[self.name] = self.check(self.name, env.get(self.name))
+        try: 
+            env[self.name] = self.check(self.name, env.get(self.name))
+        except StandardError, ex:
+            raise sys.exc_type, self.name + " - " + str(ex)
 
     def doHelp(self, out):
         """Print help for the variable.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.