diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 5a98abfffe..f275cf7813 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -1062,6 +1062,17 @@ class BaseConfig(object): | |||
1062 | self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( | 1062 | self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( |
1063 | self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) | 1063 | self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) |
1064 | 1064 | ||
1065 | def make_lock_dir(self, lockdir): | ||
1066 | if not os.path.exists(lockdir): | ||
1067 | # There might be a race issue when multi runqemu processess are | ||
1068 | # running at the same time. | ||
1069 | try: | ||
1070 | os.mkdir(lockdir) | ||
1071 | os.chmod(lockdir, 0o777) | ||
1072 | except FileExistsError: | ||
1073 | pass | ||
1074 | return | ||
1075 | |||
1065 | def setup_slirp(self): | 1076 | def setup_slirp(self): |
1066 | """Setup user networking""" | 1077 | """Setup user networking""" |
1067 | 1078 | ||
@@ -1080,14 +1091,7 @@ class BaseConfig(object): | |||
1080 | mac = 2 | 1091 | mac = 2 |
1081 | 1092 | ||
1082 | lockdir = "/tmp/qemu-port-locks" | 1093 | lockdir = "/tmp/qemu-port-locks" |
1083 | if not os.path.exists(lockdir): | 1094 | self.make_lock_dir(lockdir) |
1084 | # There might be a race issue when multi runqemu processess are | ||
1085 | # running at the same time. | ||
1086 | try: | ||
1087 | os.mkdir(lockdir) | ||
1088 | os.chmod(lockdir, 0o777) | ||
1089 | except FileExistsError: | ||
1090 | pass | ||
1091 | 1095 | ||
1092 | # Find a free port to avoid conflicts | 1096 | # Find a free port to avoid conflicts |
1093 | for p in ports[:]: | 1097 | for p in ports[:]: |
@@ -1127,14 +1131,7 @@ class BaseConfig(object): | |||
1127 | logger.error("ip: %s" % ip) | 1131 | logger.error("ip: %s" % ip) |
1128 | raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found") | 1132 | raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found") |
1129 | 1133 | ||
1130 | if not os.path.exists(lockdir): | 1134 | self.make_lock_dir(lockdir) |
1131 | # There might be a race issue when multi runqemu processess are | ||
1132 | # running at the same time. | ||
1133 | try: | ||
1134 | os.mkdir(lockdir) | ||
1135 | os.chmod(lockdir, 0o777) | ||
1136 | except FileExistsError: | ||
1137 | pass | ||
1138 | 1135 | ||
1139 | cmd = (ip, 'link') | 1136 | cmd = (ip, 'link') |
1140 | logger.debug('Running %s...' % str(cmd)) | 1137 | logger.debug('Running %s...' % str(cmd)) |