Skip to content

Commit

Permalink
python/qemu: split QEMUMachine out from underneath __init__.py
Browse files Browse the repository at this point in the history
It's not obvious that something named __init__.py actually houses
important code that isn't relevant to python packaging glue. Move the
QEMUMachine and related error classes out into their own module.

Adjust users to the new import location.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190627212816.27298-2-jsnow@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
jnsnow authored and ehabkost committed Jul 1, 2019
1 parent 08aa87f commit abf0bf9
Show file tree
Hide file tree
Showing 10 changed files with 541 additions and 520 deletions.
502 changes: 1 addition & 501 deletions python/qemu/__init__.py

Large diffs are not rendered by default.

520 changes: 520 additions & 0 deletions python/qemu/machine.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion python/qemu/qtest.py
Expand Up @@ -14,7 +14,7 @@
import socket
import os

from . import QEMUMachine
from .machine import QEMUMachine


class QEMUQtestProtocol(object):
Expand Down
2 changes: 1 addition & 1 deletion scripts/device-crash-test
Expand Up @@ -36,7 +36,7 @@ import argparse
from itertools import chain

sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
from qemu import QEMUMachine
from qemu.machine import QEMUMachine

logger = logging.getLogger('device-crash-test')
dbg = logger.debug
Expand Down
2 changes: 1 addition & 1 deletion scripts/render_block_graph.py
Expand Up @@ -25,7 +25,7 @@
from graphviz import Digraph

sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
from qemu import MonitorResponseError
from qemu.machine import MonitorResponseError


def perm(arr):
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/avocado_qemu/__init__.py
Expand Up @@ -17,7 +17,7 @@
SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..')
sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))

from qemu import QEMUMachine
from qemu.machine import QEMUMachine

def is_readable_executable_file(path):
return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/virtio_version.py
Expand Up @@ -12,7 +12,7 @@
import os

sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import QEMUMachine
from qemu.machine import QEMUMachine
from avocado_qemu import Test

# Virtio Device IDs:
Expand Down
24 changes: 12 additions & 12 deletions tests/migration/guestperf/engine.py
Expand Up @@ -30,7 +30,7 @@

sys.path.append(os.path.join(os.path.dirname(__file__),
'..', '..', '..', 'python'))
import qemu
from qemu.machine import QEMUMachine


class Engine(object):
Expand Down Expand Up @@ -386,17 +386,17 @@ def run(self, hardware, scenario, result_dir=os.getcwd()):
dstmonaddr = "/var/tmp/qemu-dst-%d-monitor.sock" % os.getpid()
srcmonaddr = "/var/tmp/qemu-src-%d-monitor.sock" % os.getpid()

src = qemu.QEMUMachine(self._binary,
args=self._get_src_args(hardware),
wrapper=self._get_src_wrapper(hardware),
name="qemu-src-%d" % os.getpid(),
monitor_address=srcmonaddr)

dst = qemu.QEMUMachine(self._binary,
args=self._get_dst_args(hardware, uri),
wrapper=self._get_dst_wrapper(hardware),
name="qemu-dst-%d" % os.getpid(),
monitor_address=dstmonaddr)
src = QEMUMachine(self._binary,
args=self._get_src_args(hardware),
wrapper=self._get_src_wrapper(hardware),
name="qemu-src-%d" % os.getpid(),
monitor_address=srcmonaddr)

dst = QEMUMachine(self._binary,
args=self._get_dst_args(hardware, uri),
wrapper=self._get_dst_wrapper(hardware),
name="qemu-dst-%d" % os.getpid(),
monitor_address=dstmonaddr)

try:
src.launch()
Expand Down
2 changes: 1 addition & 1 deletion tests/qemu-iotests/235
Expand Up @@ -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 import QEMUMachine
from qemu.machine import QEMUMachine

# Note:
# This test was added to check that mirror dead-lock was fixed (see previous
Expand Down
3 changes: 2 additions & 1 deletion tests/vm/basevm.py
Expand Up @@ -18,7 +18,8 @@
import time
import datetime
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import QEMUMachine, kvm_available
from qemu import kvm_available
from qemu.machine import QEMUMachine
import subprocess
import hashlib
import optparse
Expand Down

0 comments on commit abf0bf9

Please sign in to comment.