summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorJohn Snow2022-03-21 21:33:12 +0100
committerJohn Snow2022-04-21 17:01:00 +0200
commita4225303a1a762fb56907396fe6ac8caeb597552 (patch)
treeabb14ad84a7a303086a7308bf247b216e9b1a4fb /python
parentMerge tag 'pull-ppc-20220420-2' of https://gitlab.com/danielhb/qemu into staging (diff)
downloadqemu-a4225303a1a762fb56907396fe6ac8caeb597552.tar.gz
qemu-a4225303a1a762fb56907396fe6ac8caeb597552.tar.xz
qemu-a4225303a1a762fb56907396fe6ac8caeb597552.zip
python/machine: permanently switch to AQMP
Remove the QEMU_PYTHON_LEGACY_QMP environment variable, making the switch from sync qmp to async qmp permanent. Update exceptions and import paths as necessary. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Beraldo Leal <bleal@redhat.com> Acked-by: Hanna Reitz <hreitz@redhat.com> Message-id: 20220321203315.909411-2-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/qemu/machine/machine.py18
-rw-r--r--python/qemu/machine/qtest.py2
2 files changed, 8 insertions, 12 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index a5972fab4d..41be025ac7 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -40,21 +40,16 @@ from typing import (
TypeVar,
)
-from qemu.qmp import ( # pylint: disable=import-error
+from qemu.aqmp import SocketAddrT
+from qemu.aqmp.legacy import (
+ QEMUMonitorProtocol,
QMPMessage,
QMPReturnValue,
- SocketAddrT,
)
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__)
@@ -743,8 +738,9 @@ class QEMUMachine:
:param timeout: Optional timeout, in seconds.
See QEMUMonitorProtocol.pull_event.
- :raise QMPTimeoutError: If timeout was non-zero and no matching events
- were found.
+ :raise asyncio.TimeoutError:
+ If timeout was non-zero and no matching events were found.
+
:return: A QMP event matching the filter criteria.
If timeout was 0 and no event matched, None.
"""
@@ -767,7 +763,7 @@ class QEMUMachine:
event = self._qmp.pull_event(wait=timeout)
if event is None:
# NB: None is only returned when timeout is false-ish.
- # Timeouts raise QMPTimeoutError instead!
+ # Timeouts raise asyncio.TimeoutError instead!
break
if _match(event):
return event
diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py
index f2f9aaa5e5..13e0aaff84 100644
--- a/python/qemu/machine/qtest.py
+++ b/python/qemu/machine/qtest.py
@@ -26,7 +26,7 @@ from typing import (
TextIO,
)
-from qemu.qmp import SocketAddrT # pylint: disable=import-error
+from qemu.aqmp import SocketAddrT
from .machine import QEMUMachine