From a562362b254994095dafec4b5ded07d458cf19cd Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 9 Jan 2009 10:04:24 +0000 Subject: [PATCH] xend: Fix a ssl migration hang issue When another VM is started by xend, the spawned qemu process will keep the p2cwrite file descriptor open. Thus there will be two open descriptors associated with the write end of the pipe. The read end of the pipe only sees EOF when the qemu process has terminated. Signed-off-by: Zhigang Wang --- tools/python/xen/util/oshelp.py | 2 +- tools/python/xen/xend/server/relocate.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/util/oshelp.py b/tools/python/xen/util/oshelp.py index b5a0a2a371..3efc43d57f 100644 --- a/tools/python/xen/util/oshelp.py +++ b/tools/python/xen/util/oshelp.py @@ -5,7 +5,7 @@ def fcntl_setfd_cloexec(file, bool): f = fcntl.fcntl(file, fcntl.F_GETFD) if bool: f |= fcntl.FD_CLOEXEC else: f &= ~fcntl.FD_CLOEXEC - fcntl.fcntl(file, fcntl.F_SETFD) + fcntl.fcntl(file, fcntl.F_SETFD, f) def waitstatus_description(st): if os.WIFEXITED(st): diff --git a/tools/python/xen/xend/server/relocate.py b/tools/python/xen/xend/server/relocate.py index 007884b46a..6aa6f83d40 100644 --- a/tools/python/xen/xend/server/relocate.py +++ b/tools/python/xen/xend/server/relocate.py @@ -122,6 +122,8 @@ class RelocationProtocol(protocol.Protocol): if self.transport: self.send_reply(["ready", name]) p2cread, p2cwrite = os.pipe() + from xen.util import oshelp + oshelp.fcntl_setfd_cloexec(p2cwrite, True) threading.Thread(target=connection.SSLSocketServerConnection.recv2fd, args=(self.transport.sock, p2cwrite)).start() try: -- 2.30.2