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>
This commit is contained in:
parent
105bbff886
commit
37094b6dd5
|
@ -8,11 +8,11 @@ to change at any time.
|
||||||
Usage
|
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
|
QMP servers. The ``qemu.machine`` subpackage offers rudimentary
|
||||||
facilities for launching and managing QEMU processes. Refer to each
|
facilities for launching and managing QEMU processes. Refer to each
|
||||||
package's documentation
|
package's documentation
|
||||||
(``>>> help(qemu.aqmp)``, ``>>> help(qemu.machine)``)
|
(``>>> help(qemu.qmp)``, ``>>> help(qemu.machine)``)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
Contributing
|
Contributing
|
||||||
|
|
|
@ -3,7 +3,7 @@ QEMU Python Tooling
|
||||||
|
|
||||||
This directory houses Python tooling used by the QEMU project to build,
|
This directory houses Python tooling used by the QEMU project to build,
|
||||||
configure, and test QEMU. It is organized by namespace (``qemu``), and
|
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
|
``setup.py`` is used by ``pip`` to install this tooling to the current
|
||||||
environment. ``setup.cfg`` provides the packaging configuration used by
|
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
|
so that tools like ``qmp-shell`` are always available via $PATH. To
|
||||||
invoke them without installation, you can invoke e.g.:
|
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
|
The mappings between console script name and python module path can be
|
||||||
found in ``setup.cfg``.
|
found in ``setup.cfg``.
|
||||||
|
|
|
@ -40,8 +40,8 @@ from typing import (
|
||||||
TypeVar,
|
TypeVar,
|
||||||
)
|
)
|
||||||
|
|
||||||
from qemu.aqmp import SocketAddrT
|
from qemu.qmp import SocketAddrT
|
||||||
from qemu.aqmp.legacy import (
|
from qemu.qmp.legacy import (
|
||||||
QEMUMonitorProtocol,
|
QEMUMonitorProtocol,
|
||||||
QMPMessage,
|
QMPMessage,
|
||||||
QMPReturnValue,
|
QMPReturnValue,
|
||||||
|
|
|
@ -26,7 +26,7 @@ from typing import (
|
||||||
TextIO,
|
TextIO,
|
||||||
)
|
)
|
||||||
|
|
||||||
from qemu.aqmp import SocketAddrT
|
from qemu.qmp import SocketAddrT
|
||||||
|
|
||||||
from .machine import QEMUMachine
|
from .machine import QEMUMachine
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ asynchronously with QMP protocol servers, as implemented by QEMU, the
|
||||||
QEMU Guest Agent, and the QEMU Storage Daemon.
|
QEMU Guest Agent, and the QEMU Storage Daemon.
|
||||||
|
|
||||||
`QMPClient` provides the main functionality of this package. All errors
|
`QMPClient` provides the main functionality of this package. All errors
|
||||||
raised by this library derive from `QMPError`, see `aqmp.error` for
|
raised by this library derive from `QMPError`, see `qmp.error` for
|
||||||
additional detail. See `aqmp.events` for an in-depth tutorial on
|
additional detail. See `qmp.events` for an in-depth tutorial on
|
||||||
managing QMP events.
|
managing QMP events.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient
|
||||||
|
|
||||||
|
|
||||||
# Suppress logging unless an application engages it.
|
# 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.
|
# The order of these fields impact the Sphinx documentation order.
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
AQMP Events and EventListeners
|
QMP Events and EventListeners
|
||||||
|
|
||||||
Asynchronous QMP uses `EventListener` objects to listen for events. An
|
Asynchronous QMP uses `EventListener` objects to listen for events. An
|
||||||
`EventListener` is a FIFO event queue that can be pre-filtered to listen
|
`EventListener` is a FIFO event queue that can be pre-filtered to listen
|
|
@ -78,13 +78,13 @@ class QEMUMonitorProtocol:
|
||||||
server: bool = False,
|
server: bool = False,
|
||||||
nickname: Optional[str] = None):
|
nickname: Optional[str] = None):
|
||||||
|
|
||||||
self._aqmp = QMPClient(nickname)
|
self._qmp = QMPClient(nickname)
|
||||||
self._aloop = asyncio.get_event_loop()
|
self._aloop = asyncio.get_event_loop()
|
||||||
self._address = address
|
self._address = address
|
||||||
self._timeout: Optional[float] = None
|
self._timeout: Optional[float] = None
|
||||||
|
|
||||||
if server:
|
if server:
|
||||||
self._sync(self._aqmp.start_server(self._address))
|
self._sync(self._qmp.start_server(self._address))
|
||||||
|
|
||||||
_T = TypeVar('_T')
|
_T = TypeVar('_T')
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ class QEMUMonitorProtocol:
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_greeting(self) -> Optional[QMPMessage]:
|
def _get_greeting(self) -> Optional[QMPMessage]:
|
||||||
if self._aqmp.greeting is not None:
|
if self._qmp.greeting is not None:
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
return self._aqmp.greeting._asdict()
|
return self._qmp.greeting._asdict()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __enter__(self: _T) -> _T:
|
def __enter__(self: _T) -> _T:
|
||||||
|
@ -141,11 +141,11 @@ class QEMUMonitorProtocol:
|
||||||
:return: QMP greeting dict, or None if negotiate is false
|
:return: QMP greeting dict, or None if negotiate is false
|
||||||
:raise ConnectError: on connection errors
|
:raise ConnectError: on connection errors
|
||||||
"""
|
"""
|
||||||
self._aqmp.await_greeting = negotiate
|
self._qmp.await_greeting = negotiate
|
||||||
self._aqmp.negotiate = negotiate
|
self._qmp.negotiate = negotiate
|
||||||
|
|
||||||
self._sync(
|
self._sync(
|
||||||
self._aqmp.connect(self._address)
|
self._qmp.connect(self._address)
|
||||||
)
|
)
|
||||||
return self._get_greeting()
|
return self._get_greeting()
|
||||||
|
|
||||||
|
@ -160,10 +160,10 @@ class QEMUMonitorProtocol:
|
||||||
:return: QMP greeting dict
|
:return: QMP greeting dict
|
||||||
:raise ConnectError: on connection errors
|
:raise ConnectError: on connection errors
|
||||||
"""
|
"""
|
||||||
self._aqmp.await_greeting = True
|
self._qmp.await_greeting = True
|
||||||
self._aqmp.negotiate = True
|
self._qmp.negotiate = True
|
||||||
|
|
||||||
self._sync(self._aqmp.accept(), timeout)
|
self._sync(self._qmp.accept(), timeout)
|
||||||
|
|
||||||
ret = self._get_greeting()
|
ret = self._get_greeting()
|
||||||
assert ret is not None
|
assert ret is not None
|
||||||
|
@ -183,7 +183,7 @@ class QEMUMonitorProtocol:
|
||||||
# _raw() isn't a public API, because turning off
|
# _raw() isn't a public API, because turning off
|
||||||
# automatic ID assignment is discouraged. For
|
# automatic ID assignment is discouraged. For
|
||||||
# compatibility with iotests *only*, do it anyway.
|
# 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
|
self._timeout
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -210,7 +210,7 @@ class QEMUMonitorProtocol:
|
||||||
Build and send a QMP command to the monitor, report errors if any
|
Build and send a QMP command to the monitor, report errors if any
|
||||||
"""
|
"""
|
||||||
return self._sync(
|
return self._sync(
|
||||||
self._aqmp.execute(cmd, kwds),
|
self._qmp.execute(cmd, kwds),
|
||||||
self._timeout
|
self._timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ class QEMUMonitorProtocol:
|
||||||
"""
|
"""
|
||||||
if not wait:
|
if not wait:
|
||||||
# wait is False/0: "do not wait, do not except."
|
# wait is False/0: "do not wait, do not except."
|
||||||
if self._aqmp.events.empty():
|
if self._qmp.events.empty():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# If wait is 'True', wait forever. If wait is False/0, the events
|
# If wait is 'True', wait forever. If wait is False/0, the events
|
||||||
|
@ -243,7 +243,7 @@ class QEMUMonitorProtocol:
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
self._sync(
|
self._sync(
|
||||||
self._aqmp.events.get(),
|
self._qmp.events.get(),
|
||||||
timeout
|
timeout
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -263,7 +263,7 @@ class QEMUMonitorProtocol:
|
||||||
|
|
||||||
:return: A list of QMP events.
|
: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:
|
if events:
|
||||||
return events
|
return events
|
||||||
|
|
||||||
|
@ -272,12 +272,12 @@ class QEMUMonitorProtocol:
|
||||||
|
|
||||||
def clear_events(self) -> None:
|
def clear_events(self) -> None:
|
||||||
"""Clear current list of pending events."""
|
"""Clear current list of pending events."""
|
||||||
self._aqmp.events.clear()
|
self._qmp.events.clear()
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
"""Close the connection."""
|
"""Close the connection."""
|
||||||
self._sync(
|
self._sync(
|
||||||
self._aqmp.disconnect()
|
self._qmp.disconnect()
|
||||||
)
|
)
|
||||||
|
|
||||||
def settimeout(self, timeout: Optional[float]) -> None:
|
def settimeout(self, timeout: Optional[float]) -> None:
|
||||||
|
@ -298,10 +298,10 @@ class QEMUMonitorProtocol:
|
||||||
"""
|
"""
|
||||||
Send a file descriptor to the remote via SCM_RIGHTS.
|
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:
|
def __del__(self) -> None:
|
||||||
if self._aqmp.runstate == Runstate.IDLE:
|
if self._qmp.runstate == Runstate.IDLE:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self._aloop.is_running():
|
if not self._aloop.is_running():
|
|
@ -196,9 +196,9 @@ class AsyncProtocol(Generic[T]):
|
||||||
|
|
||||||
:param name:
|
:param name:
|
||||||
Name used for logging messages, if any. By default, messages
|
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
|
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
|
# pylint: disable=too-many-instance-attributes
|
||||||
|
|
|
@ -192,7 +192,7 @@ class QMPClient(AsyncProtocol[Message], Events):
|
||||||
await self.qmp.runstate_changed.wait()
|
await self.qmp.runstate_changed.wait()
|
||||||
await self.disconnect()
|
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 object used for debugging messages.
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -416,7 +416,7 @@ class QMPClient(AsyncProtocol[Message], Events):
|
||||||
|
|
||||||
@upper_half
|
@upper_half
|
||||||
def _get_exec_id(self) -> str:
|
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
|
self._execute_id += 1
|
||||||
return exec_id
|
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
|
An execution ID will be assigned if assign_id is `True`. It can be
|
||||||
disabled, but this requires that an ID is manually assigned
|
disabled, but this requires that an ID is manually assigned
|
||||||
instead. For manually assigned IDs, you must not use the string
|
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 msg: The QMP `Message` to execute.
|
||||||
:param assign_id: If True, assign a new execution ID.
|
: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()
|
msg['id'] = self._get_exec_id()
|
||||||
elif 'id' in msg:
|
elif 'id' in msg:
|
||||||
assert isinstance(msg['id'], str)
|
assert isinstance(msg['id'], str)
|
||||||
assert '__aqmp#' not in msg['id']
|
assert '__qmp#' not in msg['id']
|
||||||
|
|
||||||
exec_id = await self._issue(msg)
|
exec_id = await self._issue(msg)
|
||||||
return await self._reply(exec_id)
|
return await self._reply(exec_id)
|
||||||
|
@ -512,7 +512,7 @@ class QMPClient(AsyncProtocol[Message], Events):
|
||||||
Assign an arbitrary execution ID to this message. If
|
Assign an arbitrary execution ID to this message. If
|
||||||
`False`, the existing id must either be absent (and no other
|
`False`, the existing id must either be absent (and no other
|
||||||
such pending execution may omit an ID) or a string. If it is
|
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.
|
pending execution may currently be using that ID.
|
||||||
|
|
||||||
:return: Execution reply from the server.
|
: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.
|
When assign_id is `False`, an ID is given, and it is not a string.
|
||||||
:raise ValueError:
|
:raise ValueError:
|
||||||
When assign_id is `False`, but the ID is not usable;
|
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
|
# 1. convert generic Mapping or bytes to a QMP Message
|
||||||
# 2. copy Message objects so that we assign an ID only to the copy.
|
# 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 assign_id and 'id' in msg:
|
||||||
if not isinstance(exec_id, str):
|
if not isinstance(exec_id, str):
|
||||||
raise TypeError(f"ID ('{exec_id}') must be a string.")
|
raise TypeError(f"ID ('{exec_id}') must be a string.")
|
||||||
if exec_id.startswith('__aqmp#'):
|
if exec_id.startswith('__qmp#'):
|
||||||
raise ValueError(
|
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:
|
if not assign_id and exec_id in self._pending:
|
|
@ -98,8 +98,8 @@ from typing import (
|
||||||
Sequence,
|
Sequence,
|
||||||
)
|
)
|
||||||
|
|
||||||
from qemu.aqmp import ConnectError, QMPError, SocketAddrT
|
from qemu.qmp import ConnectError, QMPError, SocketAddrT
|
||||||
from qemu.aqmp.legacy import (
|
from qemu.qmp.legacy import (
|
||||||
QEMUMonitorProtocol,
|
QEMUMonitorProtocol,
|
||||||
QMPBadPortError,
|
QMPBadPortError,
|
||||||
QMPMessage,
|
QMPMessage,
|
|
@ -50,8 +50,8 @@ from typing import (
|
||||||
Sequence,
|
Sequence,
|
||||||
)
|
)
|
||||||
|
|
||||||
from qemu.aqmp import ConnectError, SocketAddrT
|
from qemu.qmp import ConnectError, SocketAddrT
|
||||||
from qemu.aqmp.legacy import QEMUMonitorProtocol
|
from qemu.qmp.legacy import QEMUMonitorProtocol
|
||||||
|
|
||||||
|
|
||||||
# This script has not seen many patches or careful attention in quite
|
# This script has not seen many patches or careful attention in quite
|
||||||
|
|
|
@ -32,7 +32,7 @@ QOM commands:
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from qemu.aqmp import ExecuteError
|
from qemu.qmp import ExecuteError
|
||||||
|
|
||||||
from .qom_common import QOMCommand
|
from .qom_common import QOMCommand
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ from typing import (
|
||||||
TypeVar,
|
TypeVar,
|
||||||
)
|
)
|
||||||
|
|
||||||
from qemu.aqmp import QMPError
|
from qemu.qmp import QMPError
|
||||||
from qemu.aqmp.legacy import QEMUMonitorProtocol
|
from qemu.qmp.legacy import QEMUMonitorProtocol
|
||||||
|
|
||||||
|
|
||||||
class ObjectPropertyInfo:
|
class ObjectPropertyInfo:
|
||||||
|
|
|
@ -48,7 +48,7 @@ from typing import (
|
||||||
import fuse
|
import fuse
|
||||||
from fuse import FUSE, FuseOSError, Operations
|
from fuse import FUSE, FuseOSError, Operations
|
||||||
|
|
||||||
from qemu.aqmp import ExecuteError
|
from qemu.qmp import ExecuteError
|
||||||
|
|
||||||
from .qom_common import QOMCommand
|
from .qom_common import QOMCommand
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ classifiers =
|
||||||
[options]
|
[options]
|
||||||
python_requires = >= 3.6
|
python_requires = >= 3.6
|
||||||
packages =
|
packages =
|
||||||
qemu.aqmp
|
qemu.qmp
|
||||||
qemu.machine
|
qemu.machine
|
||||||
qemu.utils
|
qemu.utils
|
||||||
|
|
||||||
|
@ -66,9 +66,9 @@ console_scripts =
|
||||||
qom-tree = qemu.utils.qom:QOMTree.entry_point
|
qom-tree = qemu.utils.qom:QOMTree.entry_point
|
||||||
qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse]
|
qom-fuse = qemu.utils.qom_fuse:QOMFuse.entry_point [fuse]
|
||||||
qemu-ga-client = qemu.utils.qemu_ga_client:main
|
qemu-ga-client = qemu.utils.qemu_ga_client:main
|
||||||
qmp-shell = qemu.aqmp.qmp_shell:main
|
qmp-shell = qemu.qmp.qmp_shell:main
|
||||||
qmp-shell-wrap = qemu.aqmp.qmp_shell:main_wrap
|
qmp-shell-wrap = qemu.qmp.qmp_shell:main_wrap
|
||||||
aqmp-tui = qemu.aqmp.aqmp_tui:main [tui]
|
aqmp-tui = qemu.qmp.aqmp_tui:main [tui]
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's
|
extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's
|
||||||
|
@ -84,7 +84,7 @@ namespace_packages = True
|
||||||
# fusepy has no type stubs:
|
# fusepy has no type stubs:
|
||||||
allow_subclassing_any = True
|
allow_subclassing_any = True
|
||||||
|
|
||||||
[mypy-qemu.aqmp.aqmp_tui]
|
[mypy-qemu.qmp.aqmp_tui]
|
||||||
# urwid and urwid_readline have no type stubs:
|
# urwid and urwid_readline have no type stubs:
|
||||||
allow_subclassing_any = True
|
allow_subclassing_any = True
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
import avocado
|
import avocado
|
||||||
|
|
||||||
from qemu.aqmp import ConnectError, Runstate
|
from qemu.qmp import ConnectError, Runstate
|
||||||
from qemu.aqmp.protocol import AsyncProtocol, StateError
|
from qemu.qmp.protocol import AsyncProtocol, StateError
|
||||||
from qemu.aqmp.util import asyncio_run, create_task
|
from qemu.qmp.util import asyncio_run, create_task
|
||||||
|
|
||||||
|
|
||||||
class NullProtocol(AsyncProtocol[None]):
|
class NullProtocol(AsyncProtocol[None]):
|
||||||
|
@ -183,7 +183,7 @@ class Smoke(avocado.Test):
|
||||||
def testLogger(self):
|
def testLogger(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.proto.logger.name,
|
self.proto.logger.name,
|
||||||
'qemu.aqmp.protocol'
|
'qemu.qmp.protocol'
|
||||||
)
|
)
|
||||||
|
|
||||||
def testName(self):
|
def testName(self):
|
||||||
|
@ -196,7 +196,7 @@ class Smoke(avocado.Test):
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.proto.logger.name,
|
self.proto.logger.name,
|
||||||
'qemu.aqmp.protocol.Steve'
|
'qemu.qmp.protocol.Steve'
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -431,7 +431,7 @@ class Accept(Connect):
|
||||||
await self.proto.start_server_and_accept('/dev/null')
|
await self.proto.start_server_and_accept('/dev/null')
|
||||||
|
|
||||||
async def _hanging_connection(self):
|
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")
|
sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock")
|
||||||
await self.proto.start_server_and_accept(sock)
|
await self.proto.start_server_and_accept(sock)
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ class SimpleSession(TestBase):
|
||||||
|
|
||||||
@TestBase.async_test
|
@TestBase.async_test
|
||||||
async def testSmoke(self):
|
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")
|
sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock")
|
||||||
server_task = create_task(self.server.start_server_and_accept(sock))
|
server_task = create_task(self.server.start_server_and_accept(sock))
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# compatibility levels for each CPU model.
|
# compatibility levels for each CPU model.
|
||||||
#
|
#
|
||||||
|
|
||||||
from qemu.aqmp.legacy import QEMUMonitorProtocol
|
from qemu.qmp.legacy import QEMUMonitorProtocol
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
|
|
|
@ -36,7 +36,7 @@ from itertools import chain
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
|
||||||
from qemu.machine import QEMUMachine
|
from qemu.machine import QEMUMachine
|
||||||
from qemu.aqmp import ConnectError
|
from qemu.qmp import ConnectError
|
||||||
|
|
||||||
logger = logging.getLogger('device-crash-test')
|
logger = logging.getLogger('device-crash-test')
|
||||||
dbg = logger.debug
|
dbg = logger.debug
|
||||||
|
@ -517,7 +517,7 @@ def main():
|
||||||
# Async QMP, when in use, is chatty about connection failures.
|
# Async QMP, when in use, is chatty about connection failures.
|
||||||
# This script knowingly generates a ton of connection errors.
|
# This script knowingly generates a ton of connection errors.
|
||||||
# Silence this logger.
|
# Silence this logger.
|
||||||
logging.getLogger('qemu.aqmp.qmp_client').setLevel(logging.CRITICAL)
|
logging.getLogger('qemu.qmp.qmp_client').setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
fatal_failures = []
|
fatal_failures = []
|
||||||
wl_stats = {}
|
wl_stats = {}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
|
||||||
from qemu.aqmp import qmp_shell
|
from qemu.qmp import qmp_shell
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
|
||||||
from qemu.aqmp import qmp_shell
|
from qemu.qmp import qmp_shell
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -25,8 +25,8 @@ import json
|
||||||
from graphviz import Digraph
|
from graphviz import Digraph
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
|
||||||
from qemu.aqmp import QMPError
|
from qemu.qmp import QMPError
|
||||||
from qemu.aqmp.legacy import QEMUMonitorProtocol
|
from qemu.qmp.legacy import QEMUMonitorProtocol
|
||||||
|
|
||||||
|
|
||||||
def perm(arr):
|
def perm(arr):
|
||||||
|
|
|
@ -27,7 +27,7 @@ import json
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
|
||||||
from qemu.machine import QEMUMachine
|
from qemu.machine import QEMUMachine
|
||||||
from qemu.aqmp import ConnectError
|
from qemu.qmp import ConnectError
|
||||||
|
|
||||||
|
|
||||||
def bench_block_job(cmd, cmd_args, qemu_args):
|
def bench_block_job(cmd, cmd_args, qemu_args):
|
||||||
|
|
|
@ -37,8 +37,8 @@ import unittest
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from qemu.aqmp.legacy import QMPMessage, QEMUMonitorProtocol
|
|
||||||
from qemu.machine import qtest
|
from qemu.machine import qtest
|
||||||
|
from qemu.qmp.legacy import QMPMessage, QEMUMonitorProtocol
|
||||||
from qemu.utils import VerboseProcessError
|
from qemu.utils import VerboseProcessError
|
||||||
|
|
||||||
# Use this logger for logging messages directly from the iotests module
|
# Use this logger for logging messages directly from the iotests module
|
||||||
|
|
|
@ -97,8 +97,8 @@ class TestMirrorTopPerms(iotests.QMPTestCase):
|
||||||
self.vm_b.add_blockdev(f'file,node-name=drive0,filename={source}')
|
self.vm_b.add_blockdev(f'file,node-name=drive0,filename={source}')
|
||||||
self.vm_b.add_device('virtio-blk,drive=drive0,share-rw=on')
|
self.vm_b.add_device('virtio-blk,drive=drive0,share-rw=on')
|
||||||
try:
|
try:
|
||||||
# Silence AQMP logging errors temporarily.
|
# Silence QMP logging errors temporarily.
|
||||||
with change_log_level('qemu.aqmp'):
|
with change_log_level('qemu.qmp'):
|
||||||
self.vm_b.launch()
|
self.vm_b.launch()
|
||||||
print('ERROR: VM B launched successfully, '
|
print('ERROR: VM B launched successfully, '
|
||||||
'this should not have happened')
|
'this should not have happened')
|
||||||
|
|
Loading…
Reference in New Issue