[oe-commits] [openembedded-core] 10/46: scripts/runqemu: Improve lockfile handling for python with close_fd=True

git at git.openembedded.org git at git.openembedded.org
Fri Nov 30 17:35:15 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 3c0b388515dca2d215a6bf47b4ff31b4595c2ecd
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed Nov 28 17:31:39 2018 +0000

    scripts/runqemu: Improve lockfile handling for python with close_fd=True
    
    On python versions with close_fds=True (python 3.2 onwards), the tap
    device lockfile isn't passed to the child process.
    
    Since this guards against use of an active interface, we really want this
    here, so pass it in pass_fds. This means if the parent exits early, the child
    still holds the lock, avoiding messages like:
    
    runqemu - ERROR - Failed to run qemu: qemu-system-x86_64: could not configure /dev/net/tun (tap0): Device or resource busy
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/runqemu | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index d25de42..f661892 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1220,7 +1220,10 @@ class BaseConfig(object):
         cmd = "%s %s" % (self.qemu_opt, kernel_opts)
         cmds = shlex.split(cmd)
         logger.info('Running %s\n' % cmd)
-        process = subprocess.Popen(cmds, stderr=subprocess.PIPE)
+        pass_fds = []
+        if self.lock_descriptor:
+            pass_fds = [self.lock_descriptor.fileno()]
+        process = subprocess.Popen(cmds, stderr=subprocess.PIPE, pass_fds=pass_fds)
         self.qemupid = process.pid
         retcode = process.wait()
         if retcode:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list