diff options
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index d40b3b808b..f943034092 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -28,7 +28,8 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars))) | |||
28 | 28 | ||
29 | class QemuRunner: | 29 | class QemuRunner: |
30 | 30 | ||
31 | def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, use_kvm, logger): | 31 | def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, |
32 | use_kvm, logger, use_slirp=False): | ||
32 | 33 | ||
33 | # Popen object for runqemu | 34 | # Popen object for runqemu |
34 | self.runqemu = None | 35 | self.runqemu = None |
@@ -51,6 +52,7 @@ class QemuRunner: | |||
51 | self.logged = False | 52 | self.logged = False |
52 | self.thread = None | 53 | self.thread = None |
53 | self.use_kvm = use_kvm | 54 | self.use_kvm = use_kvm |
55 | self.use_slirp = use_slirp | ||
54 | self.msg = '' | 56 | self.msg = '' |
55 | 57 | ||
56 | self.runqemutime = 120 | 58 | self.runqemutime = 120 |
@@ -129,6 +131,8 @@ class QemuRunner: | |||
129 | self.logger.debug('Not using kvm for runqemu') | 131 | self.logger.debug('Not using kvm for runqemu') |
130 | if not self.display: | 132 | if not self.display: |
131 | launch_cmd += ' nographic' | 133 | launch_cmd += ' nographic' |
134 | if self.use_slirp: | ||
135 | launch_cmd += ' slirp' | ||
132 | launch_cmd += ' %s %s' % (self.machine, self.rootfs) | 136 | launch_cmd += ' %s %s' % (self.machine, self.rootfs) |
133 | 137 | ||
134 | return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams, env=env) | 138 | return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams, env=env) |
@@ -238,9 +242,14 @@ class QemuRunner: | |||
238 | # because is possible to have control characters | 242 | # because is possible to have control characters |
239 | cmdline = re_control_char.sub(' ', cmdline) | 243 | cmdline = re_control_char.sub(' ', cmdline) |
240 | try: | 244 | try: |
241 | ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) | 245 | if self.use_slirp: |
242 | self.ip = ips[0] | 246 | tcp_ports = cmdline.split("hostfwd=tcp::")[1] |
243 | self.server_ip = ips[1] | 247 | host_port = tcp_ports[:tcp_ports.find('-')] |
248 | self.ip = "localhost:%s" % host_port | ||
249 | else: | ||
250 | ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) | ||
251 | self.ip = ips[0] | ||
252 | self.server_ip = ips[1] | ||
244 | self.logger.debug("qemu cmdline used:\n{}".format(cmdline)) | 253 | self.logger.debug("qemu cmdline used:\n{}".format(cmdline)) |
245 | except (IndexError, ValueError): | 254 | except (IndexError, ValueError): |
246 | # Try to get network configuration from runqemu output | 255 | # Try to get network configuration from runqemu output |