diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-03-17 15:18:34 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 11:35:19 +0000 |
commit | 0e4ccf17341e24a3366c701b4740f29533074e5e (patch) | |
tree | 561c24b27b29d23fdbc588627f324c9df606184b /meta | |
parent | 62dc9d964f95da3ae836087f2cfccda35af3016e (diff) | |
download | poky-0e4ccf17341e24a3366c701b4740f29533074e5e.tar.gz |
qemurunner: configure guest networking
Configured guest network interface through serial connection
when kernel is not run by qemu.
This should make it possible to test wic images with testimage.
[YOCTO #10833]
(From OE-Core rev: 2032d9be26b539bf867622c0090fb4696209eba9)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 7e5f588f60..9ef7629c11 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -195,6 +195,7 @@ class QemuRunner: | |||
195 | time.sleep(1) | 195 | time.sleep(1) |
196 | 196 | ||
197 | out = self.getOutput(output) | 197 | out = self.getOutput(output) |
198 | netconf = False # network configuration is not required by default | ||
198 | if self.is_alive(): | 199 | if self.is_alive(): |
199 | logger.info("qemu started - qemu procces pid is %s" % self.qemupid) | 200 | logger.info("qemu started - qemu procces pid is %s" % self.qemupid) |
200 | if get_ip: | 201 | if get_ip: |
@@ -215,6 +216,10 @@ class QemuRunner: | |||
215 | out, re.MULTILINE|re.DOTALL) | 216 | out, re.MULTILINE|re.DOTALL) |
216 | if match: | 217 | if match: |
217 | self.ip, self.server_ip, self.netmask = match.groups() | 218 | self.ip, self.server_ip, self.netmask = match.groups() |
219 | # network configuration is required as we couldn't get it | ||
220 | # from the runqemu command line, so qemu doesn't run kernel | ||
221 | # and guest networking is not configured | ||
222 | netconf = True | ||
218 | else: | 223 | else: |
219 | logger.error("Couldn't get ip from qemu command line and runqemu output! " | 224 | logger.error("Couldn't get ip from qemu command line and runqemu output! " |
220 | "Here is the qemu command line used:\n%s\n" | 225 | "Here is the qemu command line used:\n%s\n" |
@@ -287,6 +292,14 @@ class QemuRunner: | |||
287 | if re.search("root@[a-zA-Z0-9\-]+:~#", output): | 292 | if re.search("root@[a-zA-Z0-9\-]+:~#", output): |
288 | self.logged = True | 293 | self.logged = True |
289 | logger.info("Logged as root in serial console") | 294 | logger.info("Logged as root in serial console") |
295 | if netconf: | ||
296 | # configure guest networking | ||
297 | cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask) | ||
298 | output = self.run_serial(cmd, raw=True)[1] | ||
299 | if re.search("root@[a-zA-Z0-9\-]+:~#", output): | ||
300 | logger.info("configured ip address %s", self.ip) | ||
301 | else: | ||
302 | logger.info("Couldn't configure guest networking") | ||
290 | else: | 303 | else: |
291 | logger.info("Couldn't login into serial console" | 304 | logger.info("Couldn't login into serial console" |
292 | " as root using blank password") | 305 | " as root using blank password") |