summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2018-11-22 17:10:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-22 12:19:26 +0000
commit815e05ac4abb42238d6fdeb15d7426759e059ce1 (patch)
tree414d2952ce1620a8b7de2618de592403dd424975 /meta/lib
parent1db6a6fc9cde28d0a29bcf6d24a8bfbe51d120b1 (diff)
downloadopenembedded-core-contrib-815e05ac4abb42238d6fdeb15d7426759e059ce1.tar.gz
openembedded-core-contrib-815e05ac4abb42238d6fdeb15d7426759e059ce1.tar.bz2
openembedded-core-contrib-815e05ac4abb42238d6fdeb15d7426759e059ce1.zip
oeqa/qemu: Add support for slirp
Enable qemu for slirp. Initialize Qemurunner with slirp. Setup ip and port attribute to enable connection with qemu running with slirp. [YOCTO#10713] Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/target/qemu.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/meta/lib/oeqa/core/target/qemu.py b/meta/lib/oeqa/core/target/qemu.py
index 538bf12b6a..f47fd7468e 100644
--- a/meta/lib/oeqa/core/target/qemu.py
+++ b/meta/lib/oeqa/core/target/qemu.py
@@ -13,7 +13,7 @@ supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
class OEQemuTarget(OESSHTarget):
def __init__(self, logger, server_ip, timeout=300, user='root',
- port=None, machine='', rootfs='', kernel='', kvm=False,
+ port=None, machine='', rootfs='', kernel='', kvm=False, slirp=False,
dump_dir='', dump_host_cmds='', display='', bootlog='',
tmpdir='', dir_image='', boottime=60, **kwargs):
@@ -25,17 +25,33 @@ class OEQemuTarget(OESSHTarget):
self.rootfs = rootfs
self.kernel = kernel
self.kvm = kvm
+ self.use_slirp = slirp
self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
deploy_dir_image=dir_image, display=display,
logfile=bootlog, boottime=boottime,
- use_kvm=kvm, dump_dir=dump_dir,
+ use_kvm=kvm, use_slirp=slirp, dump_dir=dump_dir,
dump_host_cmds=dump_host_cmds, logger=logger)
def start(self, params=None, extra_bootparams=None):
+ if self.use_slirp and not self.server_ip:
+ self.logger.error("Could not start qemu with slirp without server ip - provide 'TEST_SERVER_IP'")
+ raise RuntimeError("FAILED to start qemu - check the task log and the boot log")
if self.runner.start(params, extra_bootparams=extra_bootparams):
self.ip = self.runner.ip
- self.server_ip = self.runner.server_ip
+ if self.use_slirp:
+ target_ip_port = self.runner.ip.split(':')
+ if len(target_ip_port) == 2:
+ target_ip = target_ip_port[0]
+ port = target_ip_port[1]
+ self.ip = target_ip
+ self.ssh = self.ssh + ['-p', port]
+ self.scp = self.scp + ['-P', port]
+ else:
+ self.logger.error("Could not get host machine port to connect qemu with slirp, ssh will not be "
+ "able to connect to qemu with slirp")
+ if self.runner.server_ip:
+ self.server_ip = self.runner.server_ip
else:
self.stop()
raise RuntimeError("FAILED to start qemu - check the task log and the boot log")