WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]fixed xm incorrect error information

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH]fixed xm incorrect error information
From: "Zhu Han" <schumi.han@xxxxxxxxx>
Date: Thu, 19 Jul 2007 16:10:45 +0800
Delivery-date: Thu, 19 Jul 2007 01:08:36 -0700
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=nQJDV5xpO4AQLW8NotdnshdsdP4y/+/ddHbIBonYXyvls+4lRnI0LTnYSLFl5exDzLUpNO+j3LyGpSoSF10FYlKogIMOmWIzl79AFnka8VI6KGbvVxUueUxXTbDOl6J561QZtiFoLxcPZtlrlNlq0kJlkAGqKJsldaSjvr4wDUI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=DkgOGg+Ba3rqeqhKr41pGx6Jj8x78qk6yLup0xvUfaSXlLPZjkkO+zvYLIx3Gg89rbVy5lAPpmXM6JgEvoSbSBg/pjO5yvWp7MJW2TwBXqB2sSbz0sfIs9kgPxjfsJ7/VdWxBSVVEhUb3qLi6T6oNvayTdQ/q0tXBjOl1/qWtVc=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH]fixed xm incorrect error information, Zhu Han <=