OSDN Git Service

iotests: QemuStorageDaemon: add cmd() method like in QEMUMachine.
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Fri, 6 Oct 2023 15:41:17 +0000 (18:41 +0300)
committerJohn Snow <jsnow@redhat.com>
Thu, 12 Oct 2023 18:21:43 +0000 (14:21 -0400)
Add similar method for consistency.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20231006154125.1068348-8-vsementsov@yandex-team.ru
Signed-off-by: John Snow <jsnow@redhat.com>
tests/qemu-iotests/iotests.py

index 0c061d8..ee7b6dd 100644 (file)
@@ -38,7 +38,7 @@ import unittest
 from contextlib import contextmanager
 
 from qemu.machine import qtest
-from qemu.qmp.legacy import QMPMessage, QEMUMonitorProtocol
+from qemu.qmp.legacy import QMPMessage, QMPReturnValue, QEMUMonitorProtocol
 from qemu.utils import VerboseProcessError
 
 # Use this logger for logging messages directly from the iotests module
@@ -466,6 +466,11 @@ class QemuStorageDaemon:
         assert self._qmp is not None
         return self._qmp
 
+    def cmd(self, cmd: str, args: Optional[Dict[str, object]] = None) \
+            -> QMPReturnValue:
+        assert self._qmp is not None
+        return self._qmp.cmd(cmd, **(args or {}))
+
     def stop(self, kill_signal=15):
         self._p.send_signal(kill_signal)
         self._p.wait()