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 4c06cefbff..50224f2784 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -1083,6 +1083,17 @@ to your build configuration. | |||
1083 | self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( | 1083 | self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( |
1084 | self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) | 1084 | self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) |
1085 | 1085 | ||
1086 | def make_lock_dir(self, lockdir): | ||
1087 | if not os.path.exists(lockdir): | ||
1088 | # There might be a race issue when multi runqemu processess are | ||
1089 | # running at the same time. | ||
1090 | try: | ||
1091 | os.mkdir(lockdir) | ||
1092 | os.chmod(lockdir, 0o777) | ||
1093 | except FileExistsError: | ||
1094 | pass | ||
1095 | return | ||
1096 | |||
1086 | def setup_slirp(self): | 1097 | def setup_slirp(self): |
1087 | """Setup user networking""" | 1098 | """Setup user networking""" |
1088 | 1099 | ||
@@ -1101,14 +1112,7 @@ to your build configuration. | |||
1101 | mac = 2 | 1112 | mac = 2 |
1102 | 1113 | ||
1103 | lockdir = "/tmp/qemu-port-locks" | 1114 | lockdir = "/tmp/qemu-port-locks" |
1104 | if not os.path.exists(lockdir): | 1115 | self.make_lock_dir(lockdir) |
1105 | # There might be a race issue when multi runqemu processess are | ||
1106 | # running at the same time. | ||
1107 | try: | ||
1108 | os.mkdir(lockdir) | ||
1109 | os.chmod(lockdir, 0o777) | ||
1110 | except FileExistsError: | ||
1111 | pass | ||
1112 | 1116 | ||
1113 | # Find a free port to avoid conflicts | 1117 | # Find a free port to avoid conflicts |
1114 | for p in ports[:]: | 1118 | for p in ports[:]: |
@@ -1148,14 +1152,7 @@ to your build configuration. | |||
1148 | logger.error("ip: %s" % ip) | 1152 | logger.error("ip: %s" % ip) |
1149 | raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found") | 1153 | raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found") |
1150 | 1154 | ||
1151 | if not os.path.exists(lockdir): | 1155 | self.make_lock_dir(lockdir) |
1152 | # There might be a race issue when multi runqemu processess are | ||
1153 | # running at the same time. | ||
1154 | try: | ||
1155 | os.mkdir(lockdir) | ||
1156 | os.chmod(lockdir, 0o777) | ||
1157 | except FileExistsError: | ||
1158 | pass | ||
1159 | 1156 | ||
1160 | cmd = (ip, 'link') | 1157 | cmd = (ip, 'link') |
1161 | logger.debug('Running %s...' % str(cmd)) | 1158 | logger.debug('Running %s...' % str(cmd)) |