summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorJohn Snow2022-03-30 19:28:10 +0200
committerJohn Snow2022-04-21 17:01:00 +0200
commit37094b6dd59f56978b918e79cadf17c6fd5d36e2 (patch)
treefdd2d3be3a1aafbfb722217ce3ccbfa9637cd0ec /python
parentpython: re-enable pylint duplicate-code warnings (diff)
downloadqemu-37094b6dd59f56978b918e79cadf17c6fd5d36e2.tar.gz
qemu-37094b6dd59f56978b918e79cadf17c6fd5d36e2.tar.xz
qemu-37094b6dd59f56978b918e79cadf17c6fd5d36e2.zip
python: rename qemu.aqmp to qemu.qmp
Now that we are fully switched over to the new QMP library, move it back over the old namespace. This is being done primarily so that we may upload this package simply as "qemu.qmp" without introducing confusion over whether or not "aqmp" is a new protocol or not. The trade-off is increased confusion inside the QEMU developer tree. Sorry! Note: the 'private' member "_aqmp" in legacy.py also changes to "_qmp"; not out of necessity, but just to remove any traces of the "aqmp" name. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Beraldo Leal <bleal@redhat.com> Acked-by: Hanna Reitz <hreitz@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> Message-id: 20220330172812.3427355-8-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/PACKAGE.rst4
-rw-r--r--python/README.rst4
-rw-r--r--python/qemu/machine/machine.py4
-rw-r--r--python/qemu/machine/qtest.py2
-rw-r--r--python/qemu/qmp/__init__.py (renamed from python/qemu/aqmp/__init__.py)6
-rw-r--r--python/qemu/qmp/aqmp_tui.py (renamed from python/qemu/aqmp/aqmp_tui.py)0
-rw-r--r--python/qemu/qmp/error.py (renamed from python/qemu/aqmp/error.py)0
-rw-r--r--python/qemu/qmp/events.py (renamed from python/qemu/aqmp/events.py)2
-rw-r--r--python/qemu/qmp/legacy.py (renamed from python/qemu/aqmp/legacy.py)38
-rw-r--r--python/qemu/qmp/message.py (renamed from python/qemu/aqmp/message.py)0
-rw-r--r--python/qemu/qmp/models.py (renamed from python/qemu/aqmp/models.py)0
-rw-r--r--python/qemu/qmp/protocol.py (renamed from python/qemu/aqmp/protocol.py)4
-rw-r--r--python/qemu/qmp/py.typed (renamed from python/qemu/aqmp/py.typed)0
-rw-r--r--python/qemu/qmp/qmp_client.py (renamed from python/qemu/aqmp/qmp_client.py)16
-rw-r--r--python/qemu/qmp/qmp_shell.py (renamed from python/qemu/aqmp/qmp_shell.py)4
-rw-r--r--python/qemu/qmp/util.py (renamed from python/qemu/aqmp/util.py)0
-rw-r--r--python/qemu/utils/qemu_ga_client.py4
-rw-r--r--python/qemu/utils/qom.py2
-rw-r--r--python/qemu/utils/qom_common.py4
-rw-r--r--python/qemu/utils/qom_fuse.py2
-rw-r--r--python/setup.cfg10
-rw-r--r--python/tests/protocol.py14
22 files changed, 60 insertions, 60 deletions
diff --git a/python/PACKAGE.rst b/python/PACKAGE.rst
index ddfa9ba3f5..b0b86cc4c3 100644
--- a/python/PACKAGE.rst
+++ b/python/PACKAGE.rst
@@ -8,11 +8,11 @@ to change at any time.
Usage
-----
-The ``qemu.aqmp`` subpackage provides a library for communicating with
+The ``qemu.qmp`` subpackage provides a library for communicating with
QMP servers. The ``qemu.machine`` subpackage offers rudimentary
facilities for launching and managing QEMU processes. Refer to each
package's documentation
-(``>>> help(qemu.aqmp)``, ``>>> help(qemu.machine)``)
+(``>>> help(qemu.qmp)``, ``>>> help(qemu.machine)``)
for more information.
Contributing
diff --git a/python/README.rst b/python/README.rst
index eb5213337d..9c1fceaee7 100644
--- a/python/README.rst
+++ b/python/README.rst
@@ -3,7 +3,7 @@ QEMU Python Tooling
This directory houses Python tooling used by the QEMU project to build,
configure, and test QEMU. It is organized by namespace (``qemu``), and
-then by package (e.g. ``qemu/machine``, ``qemu/aqmp``, etc).
+then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc).
``setup.py`` is used by ``pip`` to install this tooling to the current
environment. ``setup.cfg`` provides the packaging configuration used by
@@ -59,7 +59,7 @@ Package installation also normally provides executable console scripts,
so that tools like ``qmp-shell`` are always available via $PATH. To
invoke them without installation, you can invoke e.g.:
-``> PYTHONPATH=~/src/qemu/python python3 -m qemu.aqmp.qmp_shell``
+``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell``
The mappings between console script name and python module path can be
found in ``setup.cfg``.
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 41be025ac7..07ac5a710b 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -40,8 +40,8 @@ from typing import (
TypeVar,
)
-from qemu.aqmp import SocketAddrT
-from qemu.aqmp.legacy import (
+from qemu.qmp import SocketAddrT
+from qemu.qmp.legacy import (
QEMUMonitorProtocol,
QMPMessage,
QMPReturnValue,
diff --git a/python/qemu/machine/qtest.py b/python/qemu/machine/qtest.py
index 13e0aaff84..1a1fc6c9b0 100644
--- a/python/qemu/machine/qtest.py
+++ b/python/qemu/machine/qtest.py
@@ -26,7 +26,7 @@ from typing import (
TextIO,
)
-from qemu.aqmp import SocketAddrT
+from qemu.qmp import SocketAddrT
from .machine import QEMUMachine
diff --git a/python/qemu/aqmp/__init__.py b/python/qemu/qmp/__init__.py
index 2b69b264f4..69190d057a 100644
--- a/python/qemu/aqmp/__init__.py
+++ b/python/qemu/qmp/__init__.py
@@ -6,8 +6,8 @@ asynchronously with QMP protocol servers, as implemented by QEMU, the
QEMU Guest Agent, and the QEMU Storage Daemon.
`QMPClient` provides the main functionality of this package. All errors
-raised by this library derive from `QMPError`, see `aqmp.error` for
-additional detail. See `aqmp.events` for an in-depth tutorial on
+raised by this library derive from `QMPError`, see `qmp.error` for
+additional detail. See `qmp.events` for an in-depth tutorial on
managing QMP events.
"""
@@ -36,7 +36,7 @@ from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient
# Suppress logging unless an application engages it.
-logging.getLogger('qemu.aqmp').addHandler(logging.NullHandler())
+logging.getLogger('qemu.qmp').addHandler(logging.NullHandler())
# The order of these fields impact the Sphinx documentation order.
diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/qmp/aqmp_tui.py
index 59d3036be3..59d3036be3 100644
--- a/python/qemu/aqmp/aqmp_tui.py
+++ b/python/qemu/qmp/aqmp_tui.py
diff --git a/python/qemu/aqmp/error.py b/python/qemu/qmp/error.py
index 24ba4d5054..24ba4d5054 100644
--- a/python/qemu/aqmp/error.py
+++ b/python/qemu/qmp/error.py
diff --git a/python/qemu/aqmp/events.py b/python/qemu/qmp/events.py
index f3d4e2b5e8..6199776cc6 100644
--- a/python/qemu/aqmp/events.py
+++ b/python/qemu/qmp/events.py
@@ -1,5 +1,5 @@
"""
-AQMP Events and EventListeners
+QMP Events and EventListeners
Asynchronous QMP uses `EventListener` objects to listen for events. An
`EventListener` is a FIFO event queue that can be pre-filtered to listen
diff --git a/python/qemu/aqmp/legacy.py b/python/qemu/qmp/legacy.py
index dfcd20bbd2..a8629b44df 100644
--- a/python/qemu/aqmp/legacy.py
+++ b/python/qemu/qmp/legacy.py
@@ -78,13 +78,13 @@ class QEMUMonitorProtocol:
server: bool = False,
nickname: Optional[str] = None):
- self._aqmp = QMPClient(nickname)
+ self._qmp = QMPClient(nickname)
self._aloop = asyncio.get_event_loop()
self._address = address
self._timeout: Optional[float] = None
if server:
- self._sync(self._aqmp.start_server(self._address))
+ self._sync(self._qmp.start_server(self._address))
_T = TypeVar('_T')
@@ -96,9 +96,9 @@ class QEMUMonitorProtocol:
)
def _get_greeting(self) -> Optional[QMPMessage]:
- if self._aqmp.greeting is not None:
+ if self._qmp.greeting is not None:
# pylint: disable=protected-access
- return self._aqmp.greeting._asdict()
+ return self._qmp.greeting._asdict()
return None
def __enter__(self: _T) -> _T:
@@ -141,11 +141,11 @@ class QEMUMonitorProtocol:
:return: QMP greeting dict, or None if negotiate is false
:raise ConnectError: on connection errors
"""
- self._aqmp.await_greeting = negotiate
- self._aqmp.negotiate = negotiate
+ self._qmp.await_greeting = negotiate
+ self._qmp.negotiate = negotiate
self._sync(
- self._aqmp.connect(self._address)
+ self._qmp.connect(self._address)
)
return self._get_greeting()
@@ -160,10 +160,10 @@ class QEMUMonitorProtocol:
:return: QMP greeting dict
:raise ConnectError: on connection errors
"""
- self._aqmp.await_greeting = True
- self._aqmp.negotiate = True
+ self._qmp.await_greeting = True
+ self._qmp.negotiate = True
- self._sync(self._aqmp.accept(), timeout)
+ self._sync(self._qmp.accept(), timeout)
ret = self._get_greeting()
assert ret is not None
@@ -183,7 +183,7 @@ class QEMUMonitorProtocol:
# _raw() isn't a public API, because turning off
# automatic ID assignment is discouraged. For
# compatibility with iotests *only*, do it anyway.
- self._aqmp._raw(qmp_cmd, assign_id=False),
+ self._qmp._raw(qmp_cmd, assign_id=False),
self._timeout
)
)
@@ -210,7 +210,7 @@ class QEMUMonitorProtocol:
Build and send a QMP command to the monitor, report errors if any
"""
return self._sync(
- self._aqmp.execute(cmd, kwds),
+ self._qmp.execute(cmd, kwds),
self._timeout
)
@@ -231,7 +231,7 @@ class QEMUMonitorProtocol:
"""
if not wait:
# wait is False/0: "do not wait, do not except."
- if self._aqmp.events.empty():
+ if self._qmp.events.empty():
return None
# If wait is 'True', wait forever. If wait is False/0, the events
@@ -243,7 +243,7 @@ class QEMUMonitorProtocol:
return dict(
self._sync(
- self._aqmp.events.get(),
+ self._qmp.events.get(),
timeout
)
)
@@ -263,7 +263,7 @@ class QEMUMonitorProtocol:
:return: A list of QMP events.
"""
- events = [dict(x) for x in self._aqmp.events.clear()]
+ events = [dict(x) for x in self._qmp.events.clear()]
if events:
return events
@@ -272,12 +272,12 @@ class QEMUMonitorProtocol:
def clear_events(self) -> None:
"""Clear current list of pending events."""
- self._aqmp.events.clear()
+ self._qmp.events.clear()
def close(self) -> None:
"""Close the connection."""
self._sync(
- self._aqmp.disconnect()
+ self._qmp.disconnect()
)
def settimeout(self, timeout: Optional[float]) -> None:
@@ -298,10 +298,10 @@ class QEMUMonitorProtocol:
"""
Send a file descriptor to the remote via SCM_RIGHTS.
"""
- self._aqmp.send_fd_scm(fd)
+ self._qmp.send_fd_scm(fd)
def __del__(self) -> None:
- if self._aqmp.runstate == Runstate.IDLE:
+ if self._qmp.runstate == Runstate.IDLE:
return
if not self._aloop.is_running():
diff --git a/python/qemu/aqmp/message.py b/python/qemu/qmp/message.py
index f76ccc9074..f76ccc9074 100644
--- a/python/qemu/aqmp/message.py
+++ b/python/qemu/qmp/message.py
diff --git a/python/qemu/aqmp/models.py b/python/qemu/qmp/models.py
index de87f87804..de87f87804 100644
--- a/python/qemu/aqmp/models.py
+++ b/python/qemu/qmp/models.py
diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/qmp/protocol.py
index 36fae57f27..6ea86650ad 100644
--- a/python/qemu/aqmp/protocol.py
+++ b/python/qemu/qmp/protocol.py
@@ -196,9 +196,9 @@ class AsyncProtocol(Generic[T]):
:param name:
Name used for logging messages, if any. By default, messages
- will log to 'qemu.aqmp.protocol', but each individual connection
+ will log to 'qemu.qmp.protocol', but each individual connection
can be given its own logger by giving it a name; messages will
- then log to 'qemu.aqmp.protocol.${name}'.
+ then log to 'qemu.qmp.protocol.${name}'.
"""
# pylint: disable=too-many-instance-attributes
diff --git a/python/qemu/aqmp/py.typed b/python/qemu/qmp/py.typed
index e69de29bb2..e69de29bb2 100644
--- a/python/qemu/aqmp/py.typed
+++ b/python/qemu/qmp/py.typed
diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/qmp/qmp_client.py
index 90a8737f03..5dcda04a75 100644
--- a/python/qemu/aqmp/qmp_client.py
+++ b/python/qemu/qmp/qmp_client.py
@@ -192,7 +192,7 @@ class QMPClient(AsyncProtocol[Message], Events):
await self.qmp.runstate_changed.wait()
await self.disconnect()
- See `aqmp.events` for more detail on event handling patterns.
+ See `qmp.events` for more detail on event handling patterns.
"""
#: Logger object used for debugging messages.
logger = logging.getLogger(__name__)
@@ -416,7 +416,7 @@ class QMPClient(AsyncProtocol[Message], Events):
@upper_half
def _get_exec_id(self) -> str:
- exec_id = f"__aqmp#{self._execute_id:05d}"
+ exec_id = f"__qmp#{self._execute_id:05d}"
self._execute_id += 1
return exec_id
@@ -476,7 +476,7 @@ class QMPClient(AsyncProtocol[Message], Events):
An execution ID will be assigned if assign_id is `True`. It can be
disabled, but this requires that an ID is manually assigned
instead. For manually assigned IDs, you must not use the string
- '__aqmp#' anywhere in the ID.
+ '__qmp#' anywhere in the ID.
:param msg: The QMP `Message` to execute.
:param assign_id: If True, assign a new execution ID.
@@ -490,7 +490,7 @@ class QMPClient(AsyncProtocol[Message], Events):
msg['id'] = self._get_exec_id()
elif 'id' in msg:
assert isinstance(msg['id'], str)
- assert '__aqmp#' not in msg['id']
+ assert '__qmp#' not in msg['id']
exec_id = await self._issue(msg)
return await self._reply(exec_id)
@@ -512,7 +512,7 @@ class QMPClient(AsyncProtocol[Message], Events):
Assign an arbitrary execution ID to this message. If
`False`, the existing id must either be absent (and no other
such pending execution may omit an ID) or a string. If it is
- a string, it must not start with '__aqmp#' and no other such
+ a string, it must not start with '__qmp#' and no other such
pending execution may currently be using that ID.
:return: Execution reply from the server.
@@ -524,7 +524,7 @@ class QMPClient(AsyncProtocol[Message], Events):
When assign_id is `False`, an ID is given, and it is not a string.
:raise ValueError:
When assign_id is `False`, but the ID is not usable;
- Either because it starts with '__aqmp#' or it is already in-use.
+ Either because it starts with '__qmp#' or it is already in-use.
"""
# 1. convert generic Mapping or bytes to a QMP Message
# 2. copy Message objects so that we assign an ID only to the copy.
@@ -534,9 +534,9 @@ class QMPClient(AsyncProtocol[Message], Events):
if not assign_id and 'id' in msg:
if not isinstance(exec_id, str):
raise TypeError(f"ID ('{exec_id}') must be a string.")
- if exec_id.startswith('__aqmp#'):
+ if exec_id.startswith('__qmp#'):
raise ValueError(
- f"ID ('{exec_id}') must not start with '__aqmp#'."
+ f"ID ('{exec_id}') must not start with '__qmp#'."
)
if not assign_id and exec_id in self._pending:
diff --git a/python/qemu/aqmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py
index c23f1b1928..619ab42ced 100644
--- a/python/qemu/aqmp/qmp_shell.py
+++ b/python/qemu/qmp/qmp_shell.py
@@ -98,8 +98,8 @@ from typing import (
Sequence,
)
-from qemu.aqmp import ConnectError, QMPError, SocketAddrT
-from qemu.aqmp.legacy import (
+from qemu.qmp import ConnectError, QMPError, SocketAddrT
+from qemu.qmp.legacy import (
QEMUMonitorProtocol,
QMPBadPortError,
QMPMessage,
diff --git a/python/qemu/aqmp/util.py b/python/qemu/qmp/util.py
index eaa5fc7d5f..eaa5fc7d5f 100644
--- a/python/qemu/aqmp/util.py
+++ b/python/qemu/qmp/util.py
diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_ga_client.py
index 15ed430c61..8c38a7ac9c 100644
--- a/python/qemu/utils/qemu_ga_client.py
+++ b/python/qemu/utils/qemu_ga_client.py
@@ -50,8 +50,8 @@ from typing import (
Sequence,
)
-from qemu.aqmp import ConnectError, SocketAddrT
-from qemu.aqmp.legacy import QEMUMonitorProtocol
+from qemu.qmp import ConnectError, SocketAddrT
+from qemu.qmp.legacy import QEMUMonitorProtocol
# This script has not seen many patches or careful attention in quite
diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py
index bb5d1a78f5..bcf192f477 100644
--- a/python/qemu/utils/qom.py
+++ b/python/qemu/utils/qom.py
@@ -32,7 +32,7 @@ QOM commands:
import argparse
-from qemu.aqmp import ExecuteError
+from qemu.qmp import ExecuteError
from .qom_common import QOMCommand
diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common.py
index e034a6f247..80da1b2304 100644
--- a/python/qemu/utils/qom_common.py
+++ b/python/qemu/utils/qom_common.py
@@ -27,8 +27,8 @@ from typing import (
TypeVar,
)
-from qemu.aqmp import QMPError
-from qemu.aqmp.legacy import QEMUMonitorProtocol
+from qemu.qmp import QMPError
+from qemu.qmp.legacy import QEMUMonitorProtocol
class ObjectPropertyInfo:
diff --git a/python/qemu/utils/qom_fuse.py b/python/qemu/utils/qom_fuse.py
index 653a76b93b..8dcd59fcde 100644
--- a/python/qemu/utils/qom_fuse.py
+++ b/python/qemu/utils/qom_fuse.py
@@ -48,7 +48,7 @@ from typing import (
import fuse
from fuse import FUSE, FuseOSError, Operations
-from qemu.aqmp import ExecuteError
+from qemu.qmp import ExecuteError
from .qom_common import QOMCommand
diff --git a/python/setup.cfg b/python/setup.cfg
index 49e3c285f1..773e51b34e 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -24,7 +24,7 @@ classifiers =
[options]
python_requires = >= 3.6
packages =
- qemu.aqmp
+ qemu.qmp
qemu.machine
qemu.utils
@@ -66,9 +66,9 @@ console_scripts =
qom-tree = qemu.utils.qom:QOMTree.entry_point
qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse]
qemu-ga-client = qemu.utils.qemu_ga_client:main
- qmp-shell = qemu.aqmp.qmp_shell:main
- qmp-shell-wrap = qemu.aqmp.qmp_shell:main_wrap
- aqmp-tui = qemu.aqmp.aqmp_tui:main [tui]
+ qmp-shell = qemu.qmp.qmp_shell:main
+ qmp-shell-wrap = qemu.qmp.qmp_shell:main_wrap
+ aqmp-tui = qemu.qmp.aqmp_tui:main [tui]
[flake8]
extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's
@@ -84,7 +84,7 @@ namespace_packages = True
# fusepy has no type stubs:
allow_subclassing_any = True
-[mypy-qemu.aqmp.aqmp_tui]
+[mypy-qemu.qmp.aqmp_tui]
# urwid and urwid_readline have no type stubs:
allow_subclassing_any = True
diff --git a/python/tests/protocol.py b/python/tests/protocol.py
index d6849ad306..56c4d441f9 100644
--- a/python/tests/protocol.py
+++ b/python/tests/protocol.py
@@ -6,9 +6,9 @@ from tempfile import TemporaryDirectory
import avocado
-from qemu.aqmp import ConnectError, Runstate
-from qemu.aqmp.protocol import AsyncProtocol, StateError
-from qemu.aqmp.util import asyncio_run, create_task
+from qemu.qmp import ConnectError, Runstate
+from qemu.qmp.protocol import AsyncProtocol, StateError
+from qemu.qmp.util import asyncio_run, create_task
class NullProtocol(AsyncProtocol[None]):
@@ -183,7 +183,7 @@ class Smoke(avocado.Test):
def testLogger(self):
self.assertEqual(
self.proto.logger.name,
- 'qemu.aqmp.protocol'
+ 'qemu.qmp.protocol'
)
def testName(self):
@@ -196,7 +196,7 @@ class Smoke(avocado.Test):
self.assertEqual(
self.proto.logger.name,
- 'qemu.aqmp.protocol.Steve'
+ 'qemu.qmp.protocol.Steve'
)
self.assertEqual(
@@ -431,7 +431,7 @@ class Accept(Connect):
await self.proto.start_server_and_accept('/dev/null')
async def _hanging_connection(self):
- with TemporaryDirectory(suffix='.aqmp') as tmpdir:
+ with TemporaryDirectory(suffix='.qmp') as tmpdir:
sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock")
await self.proto.start_server_and_accept(sock)
@@ -587,7 +587,7 @@ class SimpleSession(TestBase):
@TestBase.async_test
async def testSmoke(self):
- with TemporaryDirectory(suffix='.aqmp') as tmpdir:
+ with TemporaryDirectory(suffix='.qmp') as tmpdir:
sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock")
server_task = create_task(self.server.start_server_and_accept(sock))