ia64/xen-unstable

changeset 9545:94971fe9c62a

Better formatting of error messages for xmlrpclib.Faults, matching similar code
in main.py.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Fri Mar 31 00:15:12 2006 +0100 (2006-03-31)
parents 1d0bd5ea2c87
children 24aa3bd826ff
files tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Fri Mar 31 00:14:09 2006 +0100
     1.2 +++ b/tools/python/xen/xm/create.py	Fri Mar 31 00:15:12 2006 +0100
     1.3 @@ -27,9 +27,11 @@ import socket
     1.4  import commands
     1.5  import time
     1.6  import re
     1.7 +import xmlrpclib
     1.8  
     1.9  from xen.xend import sxp
    1.10  from xen.xend import PrettyPrint
    1.11 +import xen.xend.XendClient
    1.12  from xen.xend.XendClient import server
    1.13  from xen.xend.XendBootloader import bootloader
    1.14  from xen.util import blkif
    1.15 @@ -814,6 +816,14 @@ def make_domain(opts, config):
    1.16  
    1.17      try:
    1.18          dominfo = server.xend.domain.create(config)
    1.19 +    except xmlrpclib.Fault, ex:
    1.20 +        import signal
    1.21 +        if vncpid:
    1.22 +            os.kill(vncpid, signal.SIGKILL)
    1.23 +        if ex.faultCode == xen.xend.XendClient.ERROR_INVALID_DOMAIN:
    1.24 +            err("the domain '%s' does not exist." % ex.faultString)
    1.25 +        else:
    1.26 +            err("%s" % ex.faultString)
    1.27      except Exception, ex:
    1.28          import signal
    1.29          if vncpid:
    1.30 @@ -824,6 +834,9 @@ def make_domain(opts, config):
    1.31  
    1.32      try:
    1.33          server.xend.domain.waitForDevices(dom)
    1.34 +    except xmlrpclib.Fault, ex:
    1.35 +        server.xend.domain.destroy(dom)
    1.36 +        err("%s" % ex.faultString)
    1.37      except:
    1.38          server.xend.domain.destroy(dom)
    1.39          err("Device creation failed for domain %s" % dom)