Don't leave vncviewer processes running if xm create fails
PATCH 1/1 Don't leave vncviewer processes running if xm create fails
this patch kill the created vncviewer process if xm create fails.
Don't leave vncviewer processes running if xm create fails
Signed-off-by Edwin Zhai <[email protected]>
Signed-off-by Arun Sharma <[email protected]>
tools/python/xen/xm/create.py +10 -2
@@ -592,9 +592,14 @@ return d return None +vncpid = None + def spawn_vnc(display): - os.system("vncviewer -log *:stdout:0 -listen %d &" % - (VNC_BASE_PORT + display)) + vncargs = (["vncviewer" + "-log", "*:stdout:0", + "-listen", "%d" % (VNC_BASE_PORT + display) ]) + global vncpid + vncpid = os.spawnvp(os.P_NOWAIT, "vncviewer", vncargs) + return VNC_BASE_PORT + display def preprocess_vnc(opts, vals):
@@ -639,6 +644,9 @@ else: dominfo = server.xend_domain_create(config) except XendError, ex: + import signal + if vncpid: + os.kill(vncpid, signal.SIGKILL) opts.err(str(ex)) dom = sxp.child_value(dominfo, 'name')
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel