[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/23] python/qmp: switch qom tools to AQMP
From: |
John Snow |
Subject: |
[PATCH 07/23] python/qmp: switch qom tools to AQMP |
Date: |
Wed, 24 Nov 2021 14:26:01 -0500 |
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/qemu/qmp/qom.py | 5 +++--
python/qemu/qmp/qom_common.py | 7 ++++---
python/qemu/qmp/qom_fuse.py | 11 ++++++-----
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/python/qemu/qmp/qom.py b/python/qemu/qmp/qom.py
index 8ff28a8343..bb5d1a78f5 100644
--- a/python/qemu/qmp/qom.py
+++ b/python/qemu/qmp/qom.py
@@ -32,7 +32,8 @@
import argparse
-from . import QMPResponseError
+from qemu.aqmp import ExecuteError
+
from .qom_common import QOMCommand
@@ -233,7 +234,7 @@ def _list_node(self, path: str) -> None:
rsp = self.qmp.command('qom-get', path=path,
property=item.name)
print(f" {item.name}: {rsp} ({item.type})")
- except QMPResponseError as err:
+ except ExecuteError as err:
print(f" {item.name}: <EXCEPTION: {err!s}> ({item.type})")
print('')
for item in items:
diff --git a/python/qemu/qmp/qom_common.py b/python/qemu/qmp/qom_common.py
index a59ae1a2a1..b145157258 100644
--- a/python/qemu/qmp/qom_common.py
+++ b/python/qemu/qmp/qom_common.py
@@ -27,7 +27,8 @@
TypeVar,
)
-from . import QEMUMonitorProtocol, QMPError
+from qemu.aqmp import AQMPError
+from qemu.aqmp.legacy import QEMUMonitorProtocol
# The following is needed only for a type alias.
@@ -82,7 +83,7 @@ class QOMCommand:
def __init__(self, args: argparse.Namespace):
if args.socket is None:
- raise QMPError("No QMP socket path or address given")
+ raise AQMPError("No QMP socket path or address given")
self.qmp = QEMUMonitorProtocol(
QEMUMonitorProtocol.parse_address(args.socket)
)
@@ -161,7 +162,7 @@ def command_runner(
try:
cmd = cls(args)
return cmd.run()
- except QMPError as err:
+ except AQMPError as err:
print(f"{type(err).__name__}: {err!s}", file=sys.stderr)
return -1
diff --git a/python/qemu/qmp/qom_fuse.py b/python/qemu/qmp/qom_fuse.py
index 43f4671fdb..653a76b93b 100644
--- a/python/qemu/qmp/qom_fuse.py
+++ b/python/qemu/qmp/qom_fuse.py
@@ -48,7 +48,8 @@
import fuse
from fuse import FUSE, FuseOSError, Operations
-from . import QMPResponseError
+from qemu.aqmp import ExecuteError
+
from .qom_common import QOMCommand
@@ -99,7 +100,7 @@ def is_object(self, path: str) -> bool:
try:
self.qom_list(path)
return True
- except QMPResponseError:
+ except ExecuteError:
return False
def is_property(self, path: str) -> bool:
@@ -112,7 +113,7 @@ def is_property(self, path: str) -> bool:
if item.name == prop:
return True
return False
- except QMPResponseError:
+ except ExecuteError:
return False
def is_link(self, path: str) -> bool:
@@ -125,7 +126,7 @@ def is_link(self, path: str) -> bool:
if item.name == prop and item.link:
return True
return False
- except QMPResponseError:
+ except ExecuteError:
return False
def read(self, path: str, size: int, offset: int, fh: IO[bytes]) -> bytes:
@@ -138,7 +139,7 @@ def read(self, path: str, size: int, offset: int, fh:
IO[bytes]) -> bytes:
try:
data = str(self.qmp.command('qom-get', path=path, property=prop))
data += '\n' # make values shell friendly
- except QMPResponseError as err:
+ except ExecuteError as err:
raise FuseOSError(EPERM) from err
if offset > len(data):
--
2.31.1
- [PATCH 04/23] python/aqmp: add SocketAddrT to package root, (continued)
- [PATCH 04/23] python/aqmp: add SocketAddrT to package root, John Snow, 2021/11/24
- [PATCH 02/23] python/aqmp: handle asyncio.TimeoutError on execute(), John Snow, 2021/11/24
- [PATCH 08/23] python/qmp: switch qmp-shell to AQMP, John Snow, 2021/11/24
- [PATCH 06/23] python/qmp: switch qemu-ga-client to AQMP, John Snow, 2021/11/24
- [PATCH 01/23] python/aqmp: add __del__ method to legacy interface, John Snow, 2021/11/24
- [PATCH 11/23] python/machine: permanently switch to AQMP, John Snow, 2021/11/24
- [PATCH 05/23] python/qemu-ga-client: update instructions to newer CLI syntax, John Snow, 2021/11/24
- [PATCH 03/23] python/aqmp: copy type definitions from qmp, John Snow, 2021/11/24
- [PATCH 09/23] python: move qmp utilities to python/qemu/utils, John Snow, 2021/11/24
- [PATCH 19/23] python/aqmp: take QMPBadPortError and parse_address from qemu.qmp, John Snow, 2021/11/24
- [PATCH 07/23] python/qmp: switch qom tools to AQMP,
John Snow <=
- [PATCH 12/23] scripts/cpu-x86-uarch-abi: fix CLI parsing, John Snow, 2021/11/24
- [PATCH 15/23] scripts/bench-block-job: switch to AQMP, John Snow, 2021/11/24
- [PATCH 17/23] iotests: switch to AQMP, John Snow, 2021/11/24
- [PATCH 14/23] scripts/render-block-graph: switch to AQMP, John Snow, 2021/11/24
- [PATCH 10/23] python: move qmp-shell under the AQMP package, John Snow, 2021/11/24
- [PATCH 16/23] iotests/mirror-top-perms: switch to AQMP, John Snow, 2021/11/24
- [PATCH 13/23] scripts/cpu-x86-uarch-abi: switch to AQMP, John Snow, 2021/11/24
- [PATCH 18/23] python: temporarily silence pylint duplicate-code warnings, John Snow, 2021/11/24
- [PATCH 20/23] python/aqmp: fully separate from qmp.QEMUMonitorProtocol, John Snow, 2021/11/24
- [PATCH 21/23] python/aqmp: copy qmp docstrings to qemu.aqmp.legacy, John Snow, 2021/11/24