deleted file mode 100644
@@ -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.
-#
new file mode 100644
@@ -0,0 +1,57 @@
+"""
+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.
+
+- QEMUMonitorProtocol: Connect to, send/receive QMP messages.
+- QEMUQtestProtocol: Connect to, send/receive qtest message.
+
+- list_accel: List available accelerators
+- kvm_available: Probe for KVM support
+- tcg_available: Probe for TCG support
+"""
+
+# Copyright (C) 2020 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 .accel import (
+ list_accel,
+ kvm_available,
+ tcg_available,
+)
+
+from .qmp import (
+ QEMUMonitorProtocol,
+)
+
+from .machine import (
+ QEMUMachine,
+)
+
+from .qtest import (
+ QEMUQtestProtocol,
+ QEMUQtestMachine,
+)
+
+__all__ = (
+ 'list_accel',
+ 'kvm_available',
+ 'tcg_available',
+ 'QEMUMonitorProtocol',
+ 'QEMUMachine',
+ 'QEMUQtestProtocol',
+ 'QEMUQtestMachine',
+)
similarity index 100%
rename from python/qemu/accel.py
rename to python/qemu/lib/accel.py
similarity index 100%
rename from python/qemu/machine.py
rename to python/qemu/lib/machine.py
similarity index 100%
rename from python/qemu/qmp.py
rename to python/qemu/lib/qmp.py
similarity index 100%
rename from python/qemu/qtest.py
rename to python/qemu/lib/qtest.py
@@ -35,7 +35,7 @@ import argparse
from itertools import chain
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
-from qemu.machine import QEMUMachine
+from qemu.lib import QEMUMachine
logger = logging.getLogger('device-crash-test')
dbg = logger.debug
@@ -42,7 +42,7 @@ import base64
import random
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu import qmp
+from qemu.lib import qmp
class QemuGuestAgent(qmp.QEMUMonitorProtocol):
@@ -75,7 +75,7 @@ import atexit
import re
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu import qmp
+from qemu.lib import qmp
if sys.version_info[0] == 2:
input = raw_input
@@ -25,7 +25,8 @@
from graphviz import Digraph
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
-from qemu.machine import MonitorResponseError
+from qemu.lib import QEMUMonitorProtocol
+from qemu.lib.machine import MonitorResponseError
def perm(arr):
@@ -25,8 +25,8 @@
import json
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.machine import QEMUMachine
-from qemu.qmp import QMPConnectError
+from qemu.lib import QEMUMachine
+from qemu.lib.qmp import QMPConnectError
def bench_block_job(cmd, cmd_args, qemu_args):
@@ -32,7 +32,7 @@
sys.path.append(os.path.join(SOURCE_DIR, 'python'))
-from qemu.machine import QEMUMachine
+from qemu.lib import QEMUMachine
def is_readable_executable_file(path):
return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
@@ -12,8 +12,7 @@
from avocado_qemu import Test, BUILD_DIR
-from qemu.accel import kvm_available
-from qemu.accel import tcg_available
+from qemu.lib import kvm_available, tcg_available
from avocado.utils import cloudinit
from avocado.utils import network
@@ -23,7 +23,7 @@
import logging
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.machine import QEMUMachine
+from qemu.lib import QEMUMachine
from avocado_qemu import Test
from avocado import skip
@@ -12,7 +12,7 @@
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.machine import QEMUMachine
+from qemu.lib import QEMUMachine
from avocado_qemu import Test
# Virtio Device IDs:
@@ -29,7 +29,7 @@
sys.path.append(os.path.join(os.path.dirname(__file__),
'..', '..', '..', 'python'))
-from qemu.machine import QEMUMachine
+from qemu.lib import QEMUMachine
class Engine(object):
@@ -25,7 +25,7 @@ from iotests import qemu_img_create, qemu_io, file_path, log
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.machine import QEMUMachine
+from qemu.lib import QEMUMachine
iotests.script_initialize(supported_fmts=['qcow2'])
@@ -34,7 +34,7 @@
# pylint: disable=import-error, wrong-import-position
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu import qtest
+from qemu.lib import qtest
assert sys.version_info >= (3, 6)
@@ -18,9 +18,6 @@
import logging
import time
import datetime
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.accel import kvm_available
-from qemu.machine import QEMUMachine
import subprocess
import hashlib
import optparse
@@ -30,6 +27,9 @@
import multiprocessing
import traceback
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
+from qemu.lib import kvm_available, QEMUMachine
+
SSH_KEY = open(os.path.join(os.path.dirname(__file__),
"..", "keys", "id_rsa")).read()
SSH_PUB_KEY = open(os.path.join(os.path.dirname(__file__),