summary refs log tree commit diff stats
path: root/python/qemu/machine
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-10-26 13:56:12 -0400
committerJohn Snow <jsnow@redhat.com>2021-11-01 11:54:59 -0400
commit76cd358671e6b8e7c435ec65b1c44200254514a9 (patch)
treeda386d95c9eecacc1c2f42cc6d5cc428959ad66c /python/qemu/machine
parentf122be6093f5fc61fe5784e342781fab07f5defc (diff)
downloadfocaccia-qemu-76cd358671e6b8e7c435ec65b1c44200254514a9.tar.gz
focaccia-qemu-76cd358671e6b8e7c435ec65b1c44200254514a9.zip
python, iotests: replace qmp with aqmp
Swap out the synchronous QEMUMonitorProtocol from qemu.qmp with the sync
wrapper from qemu.aqmp instead.

Add an escape hatch in the form of the environment variable
QEMU_PYTHON_LEGACY_QMP which allows you to cajole QEMUMachine into using
the old implementation, proving that both implementations work
concurrently.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-id: 20211026175612.4127598-9-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python/qemu/machine')
-rw-r--r--python/qemu/machine/machine.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index a0cf69786b..a487c39745 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -41,7 +41,6 @@ from typing import (
 )
 
 from qemu.qmp import (  # pylint: disable=import-error
-    QEMUMonitorProtocol,
     QMPMessage,
     QMPReturnValue,
     SocketAddrT,
@@ -50,6 +49,12 @@ from qemu.qmp import (  # pylint: disable=import-error
 from . import console_socket
 
 
+if os.environ.get('QEMU_PYTHON_LEGACY_QMP'):
+    from qemu.qmp import QEMUMonitorProtocol
+else:
+    from qemu.aqmp.legacy import QEMUMonitorProtocol
+
+
 LOG = logging.getLogger(__name__)