summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-09-14 02:45:57 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-14 22:20:05 +0100
commitec33043477a0b915b0911f7d7eacb24361e4aaa8 (patch)
tree26fb76d743d64361e244002803f0ace0b1eb205a
parente7267b4e78461e71a1175f93e2eb5e90272c2b47 (diff)
downloadopenembedded-core-contrib-ec33043477a0b915b0911f7d7eacb24361e4aaa8.tar.gz
openembedded-core-contrib-ec33043477a0b915b0911f7d7eacb24361e4aaa8.tar.bz2
openembedded-core-contrib-ec33043477a0b915b0911f7d7eacb24361e4aaa8.zip
runqemu: fix a race issue on lockdir
There might be a race issue when multi runqemu processess are running at the same time: | Traceback (most recent call last): | File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 920, in <module> | ret = main() | File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 911, in main | config.setup_network() | File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 760, in setup_network | self.setup_tap() | File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 697, in setup_tap | os.mkdir(lockdir) | FileExistsError: [Errno 17] File exists: '/tmp/qemu-tap-locks' Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/runqemu7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 9af13f3360..b6bc0ba734 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -694,7 +694,12 @@ class BaseConfig(object):
raise Exception("runqemu-ifup, runqemu-ifdown or ip not found")
if not os.path.exists(lockdir):
- os.mkdir(lockdir)
+ # There might be a race issue when multi runqemu processess are
+ # running at the same time.
+ try:
+ os.mkdir(lockdir)
+ except FileExistsError:
+ pass
cmd = '%s link' % ip
logger.info('Running %s...' % cmd)