mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
qemurunner: Add support for qmp commands
This adds support for the Qemu Machine Protocol [0] extending the current dump process for Host and Target. The commands are added in the testimage.bbclass. Currently, we setup qemu to stall until qmp gets connected and sends the initialization and continue commands, this works correctly. If the UNIX Socket does not exist, we wait an timeout to ensure to socket file is created. With this version, the monitor_dumper is created in OEQemuTarget but then set in OESSHTarget as that's where we get the SSH failure happens. Python's @property is used to create a setter/getter type of setup in OESSHTarget to get overridden by OEQemuTarget. By default the data is currently dumped to files for each command in TMPDIR/log/runtime-hostdump/<date>_qmp/unknown_<seq>_qemu_monitor as this is the naming convenstion in the dump.py code. We use the qmp.py from qemu, which needs to get installed in the recipe-sysroot-native of the target image. [0] https://github.com/qemu/qemu/blob/master/docs/interop/qmp-spec.txt (From OE-Core rev: 42af4cd2df72fc8ed9deb3fde4312909842fcf91) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
2c86aba6f0
commit
3acbec85b0
@@ -12,6 +12,7 @@ from collections import defaultdict
|
||||
|
||||
from .ssh import OESSHTarget
|
||||
from oeqa.utils.qemurunner import QemuRunner
|
||||
from oeqa.utils.dump import MonitorDumper
|
||||
from oeqa.utils.dump import TargetDumper
|
||||
|
||||
supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
|
||||
@@ -43,6 +44,11 @@ class OEQemuTarget(OESSHTarget):
|
||||
dump_host_cmds=dump_host_cmds, logger=logger,
|
||||
serial_ports=serial_ports, boot_patterns = boot_patterns,
|
||||
use_ovmf=ovmf, tmpfsdir=tmpfsdir)
|
||||
dump_monitor_cmds = kwargs.get("testimage_dump_monitor")
|
||||
self.monitor_dumper = MonitorDumper(dump_monitor_cmds, dump_dir, self.runner)
|
||||
if self.monitor_dumper:
|
||||
self.monitor_dumper.create_dir("qmp")
|
||||
|
||||
dump_target_cmds = kwargs.get("testimage_dump_target")
|
||||
self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner)
|
||||
self.target_dumper.create_dir("qemu")
|
||||
|
||||
@@ -43,6 +43,7 @@ class OESSHTarget(OETarget):
|
||||
if port:
|
||||
self.ssh = self.ssh + [ '-p', port ]
|
||||
self.scp = self.scp + [ '-P', port ]
|
||||
self._monitor_dumper = None
|
||||
|
||||
def start(self, **kwargs):
|
||||
pass
|
||||
@@ -50,6 +51,15 @@ class OESSHTarget(OETarget):
|
||||
def stop(self, **kwargs):
|
||||
pass
|
||||
|
||||
@property
|
||||
def monitor_dumper(self):
|
||||
return self._monitor_dumper
|
||||
|
||||
@monitor_dumper.setter
|
||||
def monitor_dumper(self, dumper):
|
||||
self._monitor_dumper = dumper
|
||||
self.monitor_dumper.dump_monitor()
|
||||
|
||||
def _run(self, command, timeout=None, ignore_status=True):
|
||||
"""
|
||||
Runs command in target using SSHProcess.
|
||||
@@ -87,9 +97,14 @@ class OESSHTarget(OETarget):
|
||||
processTimeout = self.timeout
|
||||
|
||||
status, output = self._run(sshCmd, processTimeout, True)
|
||||
self.logger.debug('Command: %s\nOutput: %s\n' % (command, output))
|
||||
self.logger.debug('Command: %s\nStatus: %d Output: %s\n' % (command, status, output))
|
||||
if (status == 255) and (('No route to host') in output):
|
||||
if self.monitor_dumper:
|
||||
self.monitor_dumper.dump_monitor()
|
||||
if status == 255:
|
||||
self.target_dumper.dump_target()
|
||||
if self.monitor_dumper:
|
||||
self.monitor_dumper.dump_monitor()
|
||||
return (status, output)
|
||||
|
||||
def copyTo(self, localSrc, remoteDst):
|
||||
|
||||
Reference in New Issue
Block a user