ia64/xen-unstable

changeset 6523:f90820349056

Don't leave vncviewer processes running if xm create fails

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author adsharma@los-vmm.sc.intel.com
date Thu Aug 11 10:44:59 2005 -0800 (2005-08-11)
parents dc61689b4781
children c589ca6d292b
files tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Wed Aug 10 10:44:42 2005 -0800
     1.2 +++ b/tools/python/xen/xm/create.py	Thu Aug 11 10:44:59 2005 -0800
     1.3 @@ -592,9 +592,14 @@ def choose_vnc_display():
     1.4          return d
     1.5      return None
     1.6  
     1.7 +vncpid = None
     1.8 +
     1.9  def spawn_vnc(display):
    1.10 -    os.system("vncviewer -log *:stdout:0 -listen %d &" %
    1.11 -              (VNC_BASE_PORT + display))
    1.12 +    vncargs = (["vncviewer" + "-log", "*:stdout:0",
    1.13 +            "-listen", "%d" % (VNC_BASE_PORT + display) ])
    1.14 +    global vncpid    
    1.15 +    vncpid = os.spawnvp(os.P_NOWAIT, "vncviewer", vncargs)
    1.16 +
    1.17      return VNC_BASE_PORT + display
    1.18      
    1.19  def preprocess_vnc(opts, vals):
    1.20 @@ -639,6 +644,9 @@ def make_domain(opts, config):
    1.21          else:
    1.22              dominfo = server.xend_domain_create(config)
    1.23      except XendError, ex:
    1.24 +        import signal
    1.25 +        if vncpid:
    1.26 +            os.kill(vncpid, signal.SIGKILL)
    1.27          opts.err(str(ex))
    1.28  
    1.29      dom = sxp.child_value(dominfo, 'name')