[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH]fixed xm incorrect error information
Hi, all I don't understand why do_console in xm/create.py will try to start the console inside a loop. If the domain crashed before execConsole, get_domid could throw out an exception and then os.waitpid will throw out OSError and complain about no such child process. Obviously, this is an incorrect error information. The attached patch fixs it: signed-off-by: Zhu Han<schumi.han@xxxxxxxxx> diff -r 3ef0510e44d0 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Tue May 08 10:21:23 2007 +0100 +++ b/tools/python/xen/xm/create.py Thu Jul 19 15:56:45 2007 +0800 @@ -1311,24 +1311,28 @@ def do_console(domain_name): def do_console(domain_name): cpid = os.fork() if cpid != 0: - for i in range(10): - # Catch failure of the create process - time.sleep(1) - (p, rv) = os.waitpid(cpid, os.WNOHANG) - if os.WIFEXITED(rv): - if os.WEXITSTATUS(rv) != 0: - sys.exit(os.WEXITSTATUS(rv)) - try: - # Acquire the console of the created dom - if serverType == SERVER_XEN_API: - domid = server.xenapi.VM.get_domid( - get_single_vm(domain_name)) - else: - dom = server.xend.domain(domain_name) - domid = int(sxp.child_value(dom, 'domid', '-1')) - console.execConsole(domid) - except: - pass + # Catch failure of the create process + time.sleep(1) + (p, rv) = os.waitpid(cpid, os.WNOHANG) + if os.WIFEXITED(rv): + if os.WEXITSTATUS(rv) != 0: + sys.exit(os.WEXITSTATUS(rv)) + try: + # Acquire the console of the created dom + if serverType == SERVER_XEN_API: + domid = server.xenapi.VM.get_domid( + get_single_vm(domain_name)) + else: + dom = server.xend.domain(domain_name) + domid = int(sxp.child_value(dom, 'domid', '-1')) + except: + print("can't get domain id. domain crashed?\n") + sys.exit(0) + + try: + console.execConsole(domid) + except: + pass print("Could not start console\n"); sys.exit(0) -- best regards, hanzhu Attachment:
xm_create.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |