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-21 22:42:59 +0000 |
commit | 2032d9be26b539bf867622c0090fb4696209eba9 (patch) | |
tree | 5e3c30a4b35da82b167252c7171290cff233967b /meta/lib/oeqa/utils | |
parent | d4d7ed48c1cff1351ddc2f60bcfa153c373a8ab8 (diff) | |
download | openembedded-core-2032d9be26b539bf867622c0090fb4696209eba9.tar.gz openembedded-core-2032d9be26b539bf867622c0090fb4696209eba9.tar.bz2 openembedded-core-2032d9be26b539bf867622c0090fb4696209eba9.zip |
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-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: time.sleep(1) out = self.getOutput(output) + netconf = False # network configuration is not required by default if self.is_alive(): logger.info("qemu started - qemu procces pid is %s" % self.qemupid) if get_ip: @@ -215,6 +216,10 @@ class QemuRunner: out, re.MULTILINE|re.DOTALL) if match: self.ip, self.server_ip, self.netmask = match.groups() + # network configuration is required as we couldn't get it + # from the runqemu command line, so qemu doesn't run kernel + # and guest networking is not configured + netconf = True else: logger.error("Couldn't get ip from qemu command line and runqemu output! " "Here is the qemu command line used:\n%s\n" @@ -287,6 +292,14 @@ class QemuRunner: if re.search("root@[a-zA-Z0-9\-]+:~#", output): self.logged = True logger.info("Logged as root in serial console") + if netconf: + # configure guest networking + cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask) + output = self.run_serial(cmd, raw=True)[1] + if re.search("root@[a-zA-Z0-9\-]+:~#", output): + logger.info("configured ip address %s", self.ip) + else: + logger.info("Couldn't configure guest networking") else: logger.info("Couldn't login into serial console" " as root using blank password") |