Skip to contentSkip to conversation

Fix vnet-create error checking and another stack dump

PATCH New Dan Smith 1 participant 1 message Nov 3, 2005

lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 Fix vnet-create error checking and another stack dump

This patch adds a check to make sure the config file passed to vnet-create is correct. This is better than throwing IOError, because IOError's are currently reported as xend communication failures. Also, fix the IOError handling at the end of the file so we don't get a stack dump if that path is taken.

tools/python/xen/xm/main.py +5 -1
diff -r 289b73a5ace7 tools/python/xen/xm/main.py
@@ -660,6 +660,10 @@
 def xm_vnet_create(args):
     arg_check(args, 1, "vnet-create")
     conf = args[0]
+    if not os.access(conf, os.R_OK):
+        print "File not found: %s" % conf
+        sys.exit(1)
+
     from xen.xend.XendClient import server
     server.xend_vnet_create(conf)
 
@@ -794,7 +798,7 @@
         except KeyboardInterrupt:
             print "Interrupted."
             sys.exit(1)
-        except IOError:
+        except IOError, ex:
             if os.geteuid() != 0:
                 err("Most commands need root access.  Please try again as root.")
             else:
Signature · 5 lines
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel