diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/.isort.cfg (renamed from python/qemu/.isort.cfg) | 0 | ||||
-rw-r--r-- | python/qemu/__init__.py | 11 | ||||
-rw-r--r-- | python/qemu/machine/.flake8 (renamed from python/qemu/.flake8) | 0 | ||||
-rw-r--r-- | python/qemu/machine/__init__.py | 33 | ||||
-rw-r--r-- | python/qemu/machine/console_socket.py (renamed from python/qemu/console_socket.py) | 0 | ||||
-rw-r--r-- | python/qemu/machine/machine.py (renamed from python/qemu/machine.py) | 16 | ||||
-rw-r--r-- | python/qemu/machine/pylintrc (renamed from python/qemu/pylintrc) | 0 | ||||
-rw-r--r-- | python/qemu/machine/qtest.py (renamed from python/qemu/qtest.py) | 3 | ||||
-rw-r--r-- | python/qemu/qmp/__init__.py (renamed from python/qemu/qmp.py) | 12 | ||||
-rw-r--r-- | python/qemu/utils/__init__.py (renamed from python/qemu/utils.py) | 18 | ||||
-rw-r--r-- | python/qemu/utils/accel.py (renamed from python/qemu/accel.py) | 0 |
11 files changed, 72 insertions, 21 deletions
diff --git a/python/qemu/.isort.cfg b/python/.isort.cfg index 6d0fd6cc0d..6d0fd6cc0d 100644 --- a/python/qemu/.isort.cfg +++ b/python/.isort.cfg diff --git a/python/qemu/__init__.py b/python/qemu/__init__.py deleted file mode 100644 index 4ca06c34a4..0000000000 --- a/python/qemu/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# QEMU library -# -# Copyright (C) 2015-2016 Red Hat Inc. -# Copyright (C) 2012 IBM Corp. -# -# Authors: -# Fam Zheng <famz@redhat.com> -# -# This work is licensed under the terms of the GNU GPL, version 2. See -# the COPYING file in the top-level directory. -# diff --git a/python/qemu/.flake8 b/python/qemu/machine/.flake8 index 45d8146f3f..45d8146f3f 100644 --- a/python/qemu/.flake8 +++ b/python/qemu/machine/.flake8 diff --git a/python/qemu/machine/__init__.py b/python/qemu/machine/__init__.py new file mode 100644 index 0000000000..98302ea31e --- /dev/null +++ b/python/qemu/machine/__init__.py @@ -0,0 +1,33 @@ +""" +QEMU development and testing library. + +This library provides a few high-level classes for driving QEMU from a +test suite, not intended for production use. + +- QEMUMachine: Configure and Boot a QEMU VM + - QEMUQtestMachine: VM class, with a qtest socket. + +- QEMUQtestProtocol: Connect to, send/receive qtest messages. +""" + +# Copyright (C) 2020-2021 John Snow for Red Hat Inc. +# Copyright (C) 2015-2016 Red Hat Inc. +# Copyright (C) 2012 IBM Corp. +# +# Authors: +# John Snow <jsnow@redhat.com> +# Fam Zheng <fam@euphon.net> +# +# This work is licensed under the terms of the GNU GPL, version 2. See +# the COPYING file in the top-level directory. +# + +from .machine import QEMUMachine +from .qtest import QEMUQtestMachine, QEMUQtestProtocol + + +__all__ = ( + 'QEMUMachine', + 'QEMUQtestProtocol', + 'QEMUQtestMachine', +) diff --git a/python/qemu/console_socket.py b/python/qemu/machine/console_socket.py index 8c4ff598ad..8c4ff598ad 100644 --- a/python/qemu/console_socket.py +++ b/python/qemu/machine/console_socket.py diff --git a/python/qemu/machine.py b/python/qemu/machine/machine.py index a8837b36e4..d33b02d2ce 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine/machine.py @@ -38,8 +38,14 @@ from typing import ( Type, ) -from . import console_socket, qmp -from .qmp import QMPMessage, QMPReturnValue, SocketAddrT +from qemu.qmp import ( + QEMUMonitorProtocol, + QMPMessage, + QMPReturnValue, + SocketAddrT, +) + +from . import console_socket LOG = logging.getLogger(__name__) @@ -139,7 +145,7 @@ class QEMUMachine: self._events: List[QMPMessage] = [] self._iolog: Optional[str] = None self._qmp_set = True # Enable QMP monitor by default. - self._qmp_connection: Optional[qmp.QEMUMonitorProtocol] = None + self._qmp_connection: Optional[QEMUMonitorProtocol] = None self._qemu_full_args: Tuple[str, ...] = () self._temp_dir: Optional[str] = None self._launched = False @@ -314,7 +320,7 @@ class QEMUMachine: if self._remove_monitor_sockfile: assert isinstance(self._monitor_address, str) self._remove_files.append(self._monitor_address) - self._qmp_connection = qmp.QEMUMonitorProtocol( + self._qmp_connection = QEMUMonitorProtocol( self._monitor_address, server=True, nickname=self._name @@ -541,7 +547,7 @@ class QEMUMachine: self._qmp_set = enabled @property - def _qmp(self) -> qmp.QEMUMonitorProtocol: + def _qmp(self) -> QEMUMonitorProtocol: if self._qmp_connection is None: raise QEMUMachineError("Attempt to access QMP with no connection") return self._qmp_connection diff --git a/python/qemu/pylintrc b/python/qemu/machine/pylintrc index 3f69205000..3f69205000 100644 --- a/python/qemu/pylintrc +++ b/python/qemu/machine/pylintrc diff --git a/python/qemu/qtest.py b/python/qemu/machine/qtest.py index 78b97d13cf..e893ca3697 100644 --- a/python/qemu/qtest.py +++ b/python/qemu/machine/qtest.py @@ -26,8 +26,9 @@ from typing import ( TextIO, ) +from qemu.qmp import SocketAddrT + from .machine import QEMUMachine -from .qmp import SocketAddrT class QEMUQtestProtocol: diff --git a/python/qemu/qmp.py b/python/qemu/qmp/__init__.py index 2cd4d43036..9606248a3d 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp/__init__.py @@ -1,4 +1,14 @@ -""" QEMU Monitor Protocol Python class """ +""" +QEMU Monitor Protocol (QMP) development library & tooling. + +This package provides a fairly low-level class for communicating to QMP +protocol servers, as implemented by QEMU, the QEMU Guest Agent, and the +QEMU Storage Daemon. This library is not intended for production use. + +`QEMUMonitorProtocol` is the primary class of interest, and all errors +raised derive from `QMPError`. +""" + # Copyright (C) 2009, 2010 Red Hat Inc. # # Authors: diff --git a/python/qemu/utils.py b/python/qemu/utils/__init__.py index 5ed789275e..7f1a5138c4 100644 --- a/python/qemu/utils.py +++ b/python/qemu/utils/__init__.py @@ -1,13 +1,14 @@ """ -QEMU utility library +QEMU development and testing utilities -This offers miscellaneous utility functions, which may not be easily -distinguishable or numerous to be in their own module. +This package provides a small handful of utilities for performing +various tasks not directly related to the launching of a VM. """ # Copyright (C) 2021 Red Hat Inc. # # Authors: +# John Snow <jsnow@redhat.com> # Cleber Rosa <crosa@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See @@ -17,6 +18,17 @@ distinguishable or numerous to be in their own module. import re from typing import Optional +# pylint: disable=import-error +from .accel import kvm_available, list_accel, tcg_available + + +__all__ = ( + 'get_info_usernet_hostfwd_port', + 'kvm_available', + 'list_accel', + 'tcg_available', +) + def get_info_usernet_hostfwd_port(info_usernet_output: str) -> Optional[int]: """ diff --git a/python/qemu/accel.py b/python/qemu/utils/accel.py index 297933df2a..297933df2a 100644 --- a/python/qemu/accel.py +++ b/python/qemu/utils/accel.py |