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-changelog

[Xen-changelog] Raise an exception if an error appears on the pipes to o

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Raise an exception if an error appears on the pipes to our children, and make
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 06 Oct 2005 10:16:11 +0000
Delivery-date: Thu, 06 Oct 2005 10:13:42 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@ewan
# Node ID 971e7c7411b358dec5c48fe62f55e56de9e38a94
# Parent  6f71824a45c19e860a3655dd8e76a83e047c84d2
Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception.  Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 6f71824a45c1 -r 971e7c7411b3 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Wed Oct  5 17:06:42 2005
+++ b/tools/python/xen/xend/XendCheckpoint.py   Thu Oct  6 09:13:11 2005
@@ -116,6 +116,7 @@
 
     assert dominfo.store_channel
     assert dominfo.console_channel
+    assert dominfo.getDomainPath()
 
     try:
         l = read_exact(fd, sizeof_unsigned_long,
@@ -138,6 +139,11 @@
             if m:
                 store_mfn = int(m.group(2))
                 dominfo.setStoreRef(store_mfn)
+                log.debug("IntroduceDomain %d %d %d %s",
+                          dominfo.getDomid(),
+                          store_mfn,
+                          dominfo.store_channel.port1,
+                          dominfo.getDomainPath())
                 IntroduceDomain(dominfo.getDomid(),
                                 store_mfn,
                                 dominfo.store_channel.port1,
@@ -161,34 +167,40 @@
     if closeToChild:
         child.tochild.close()
 
-    fds = [child.fromchild.fileno(),
-           child.childerr.fileno()]
-    p = select.poll()
-    map(p.register, fds)
-    while len(fds) > 0:
-        r = p.poll()
-        for (fd, event) in r:
-            if event & select.POLLHUP or event & select.POLLERR:
-                fds.remove(fd)
-                p.unregister(fd)
-                continue
-            if not event & select.POLLIN:
-                continue
-            if fd == child.childerr.fileno():
-                lasterr = child.childerr.readline().rstrip()
-                log.error('%s', lasterr)
-            else:
-                l = child.fromchild.readline().rstrip()
-                while l:
-                    log.debug('%s', l)
-                    inputHandler(l, child.tochild)
-                    try:
+    try:
+        fds = [child.fromchild.fileno(),
+               child.childerr.fileno()]
+        p = select.poll()
+        map(p.register, fds)
+        while len(fds) > 0:
+            r = p.poll()
+            for (fd, event) in r:
+                if event & select.POLLIN:
+                    if fd == child.childerr.fileno():
+                        lasterr = child.childerr.readline().rstrip()
+                        log.error('%s', lasterr)
+                    else:
                         l = child.fromchild.readline().rstrip()
-                    except:
-                        l = None
-
-    child.fromchild.close()
-    child.childerr.close()
+                        while l:
+                            log.debug('%s', l)
+                            inputHandler(l, child.tochild)
+                            try:
+                                l = child.fromchild.readline().rstrip()
+                            except:
+                                l = None
+
+                if event & select.POLLERR:
+                    raise XendError('Error reading from child process for %s',
+                                    cmd)
+
+                if event & select.POLLHUP:
+                    fds.remove(fd)
+                    p.unregister(fd)
+    finally:
+        child.fromchild.close()
+        child.childerr.close()
+        if not closeToChild:
+            child.tochild.close()
 
     if child.wait() >> 8 == 127:
         lasterr = "popen failed"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Raise an exception if an error appears on the pipes to our children, and make, Xen patchbot -unstable <=