ia64/xen-unstable

changeset 7627:1a5861311b04

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.

Signed-off-by: Dan Smith <danms@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Nov 04 11:06:41 2005 +0100 (2005-11-04)
parents d9d88dd713ba
children 21d175472d55
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Fri Nov 04 11:05:10 2005 +0100
     1.2 +++ b/tools/python/xen/xm/main.py	Fri Nov 04 11:06:41 2005 +0100
     1.3 @@ -666,6 +666,10 @@ def xm_vnet_list(args):
     1.4  def xm_vnet_create(args):
     1.5      arg_check(args, 1, "vnet-create")
     1.6      conf = args[0]
     1.7 +    if not os.access(conf, os.R_OK):
     1.8 +        print "File not found: %s" % conf
     1.9 +        sys.exit(1)
    1.10 +
    1.11      from xen.xend.XendClient import server
    1.12      server.xend_vnet_create(conf)
    1.13  
    1.14 @@ -800,7 +804,7 @@ def main(argv=sys.argv):
    1.15          except KeyboardInterrupt:
    1.16              print "Interrupted."
    1.17              sys.exit(1)
    1.18 -        except IOError:
    1.19 +        except IOError, ex:
    1.20              if os.geteuid() != 0:
    1.21                  err("Most commands need root access.  Please try again as root.")
    1.22              else: