virtinst: Switch to relative imports, fix cyclic import warnings

This commit is contained in:
Cole Robinson 2014-09-12 15:59:22 -04:00
parent f512c05381
commit eb7612356e
50 changed files with 210 additions and 186 deletions

View File

@ -53,14 +53,10 @@ class parser_class(object):
raise NotImplementedError
from virtconv.vmx import vmx_parser as _vmx_parser
from virtconv.ovf import ovf_parser as _ovf_parser
_parsers = [
_vmx_parser,
_ovf_parser,
]
def _get_parsers():
from .vmx import vmx_parser
from .ovf import ovf_parser
return [vmx_parser, ovf_parser]
def _is_test():
@ -71,7 +67,7 @@ def _find_parser_by_name(input_name):
"""
Return the parser of the given name.
"""
parsers = [p for p in _parsers if p.name == input_name]
parsers = [p for p in _get_parsers() if p.name == input_name]
if len(parsers):
return parsers[0]
raise RuntimeError(_("No parser found for type '%s'") % input_name)
@ -81,7 +77,7 @@ def _find_parser_by_file(input_file):
"""
Return the parser that is capable of comprehending the given file.
"""
for p in _parsers:
for p in _get_parsers():
if p.identify_file(input_file):
return p
raise RuntimeError(_("Don't know how to parse file %s") % input_file)
@ -155,7 +151,7 @@ def _find_input(input_file, parser, print_cb):
parser = _find_parser_by_file(input_file)
return input_file, parser, force_clean
parsers = parser and [parser] or _parsers
parsers = parser and [parser] or _get_parsers()
for root, ignore, files in os.walk(input_file):
for p in parsers:
for f in [f for f in files if f.endswith(p.suffix)]:

View File

@ -25,7 +25,7 @@ import libxml2
import virtinst
from virtconv.formats import parser_class
from .formats import parser_class
# Mapping of ResourceType value to device type

View File

@ -27,7 +27,7 @@ import shlex
import virtinst
from virtinst import util
from virtconv.formats import parser_class
from .formats import parser_class
class _VMXLine(object):

View File

@ -34,7 +34,7 @@ def _setup_i18n():
_setup_i18n()
stable_defaults = _cliconfig.stable_defaults
from virtinst import util
from . import util
from virtinst import support
from virtinst.osxml import OSXML
@ -50,7 +50,7 @@ from virtinst.seclabel import Seclabel
from virtinst.pm import PM
from virtinst.idmap import IdMap
import virtinst.capabilities as CapabilitiesParser
from virtinst import capabilities as CapabilitiesParser
from virtinst.interface import Interface, InterfaceProtocol
from virtinst.network import Network
from virtinst.nodedev import NodeDevice

View File

@ -21,7 +21,7 @@
import re
from virtinst import util
from . import util
# Whether a guest can be created with a certain feature on resp. off
FEATURE_ON = 0x01
@ -688,8 +688,8 @@ class Capabilities(object):
return (guest, domain)
def build_virtinst_guest(self, conn, guest, domain):
from virtinst import Guest as VGuest
gobj = VGuest(conn)
from .guest import Guest as VMGuest
gobj = VMGuest(conn)
gobj.type = domain.hypervisor_type
gobj.os.os_type = guest.os_type
gobj.os.arch = guest.arch

View File

@ -31,8 +31,29 @@ import libvirt
from virtcli import cliconfig
import virtinst
from virtinst import util
from . import util
from .clock import Clock
from .deviceaudio import VirtualAudio
from .devicechar import (VirtualChannelDevice, VirtualConsoleDevice,
VirtualSerialDevice, VirtualParallelDevice)
from .devicecontroller import VirtualController
from .devicedisk import VirtualDisk
from .devicefilesystem import VirtualFilesystem
from .devicegraphics import VirtualGraphics
from .devicehostdev import VirtualHostDevice
from .deviceinterface import VirtualNetworkInterface
from .devicememballoon import VirtualMemballoon
from .devicepanic import VirtualPanicDevice
from .deviceredirdev import VirtualRedirDevice
from .devicerng import VirtualRNGDevice
from .devicesmartcard import VirtualSmartCardDevice
from .devicetpm import VirtualTPMDevice
from .devicevideo import VirtualVideoDevice
from .devicewatchdog import VirtualWatchdog
from .domainnumatune import DomainNumatune
from .nodedev import NodeDevice
from .osxml import OSXML
from .storage import StoragePool, StorageVolume
force = False
@ -202,8 +223,10 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True):
##############################
def getConnection(uri):
from .connection import VirtualConnection
logging.debug("Requesting libvirt URI %s", (uri or "default"))
conn = virtinst.VirtualConnection(uri)
conn = VirtualConnection(uri)
conn.open(_do_creds_authname)
conn.cache_object_fetch = True
logging.debug("Received libvirt URI %s", conn.uri)
@ -311,7 +334,7 @@ def validate_disk(dev, warn_overwrite=False):
"""
if not warn_overwrite:
return
if virtinst.VirtualDisk.path_exists(dev.conn, dev.path):
if VirtualDisk.path_exists(dev.conn, dev.path):
_optional_fail(
_("This will overwrite the existing path '%s'" % dev.path))
@ -409,8 +432,8 @@ def show_console_for_guest(guest):
gtype = gdev[0].type
if gtype in ["default",
virtinst.VirtualGraphics.TYPE_VNC,
virtinst.VirtualGraphics.TYPE_SPICE]:
VirtualGraphics.TYPE_VNC,
VirtualGraphics.TYPE_SPICE]:
logging.debug("Launching virt-viewer for graphics type '%s'", gtype)
return _gfx_console(guest)
else:
@ -1048,7 +1071,7 @@ class VirtCLIParser(object):
@cli_arg_name: The command line argument this maps to, so
"host-device" for --host-device
@guest: Will be set parse(), the toplevel virtinst.Guest object
@guest: Will be set parse(), the toplevel Guest object
@remove_first: Passed to VirtOptionString
@check_none: If the parsed option string is just 'none', return None
@support_cb: An extra support check function for further validation.
@ -1303,7 +1326,7 @@ class ParserVCPU(VirtCLIParser):
def set_cpuset_cb(opts, inst, cliname, val):
if val == "auto":
try:
val = virtinst.DomainNumatune.generate_cpuset(
val = DomainNumatune.generate_cpuset(
inst.conn, inst.memory)
logging.debug("Auto cpuset is: %s", val)
except Exception, e:
@ -1431,7 +1454,7 @@ class ParserBoot(VirtCLIParser):
# Order matters for boot devices, we handle it specially in parse
def noset_cb(val):
ignore = val
for b in virtinst.OSXML.BOOT_DEVICES:
for b in OSXML.BOOT_DEVICES:
self.set_param(noset_cb, b)
def _parse(self, opts, inst):
@ -1537,7 +1560,7 @@ class ParserClock(VirtCLIParser):
setattr(timerobj, attrname, val)
for tname in virtinst.Clock.TIMER_NAMES:
for tname in Clock.TIMER_NAMES:
self.set_param(None, tname + "_present",
is_onoff=True,
setter_cb=set_timer)
@ -1586,13 +1609,13 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
if path:
abspath = os.path.abspath(path)
if os.path.dirname(abspath) == "/var/lib/libvirt/images":
virtinst.StoragePool.build_default_pool(guest.conn)
StoragePool.build_default_pool(guest.conn)
elif pool:
if not size:
raise ValueError(_("Size must be specified with all 'pool='"))
if pool == "default":
virtinst.StoragePool.build_default_pool(guest.conn)
StoragePool.build_default_pool(guest.conn)
poolobj = guest.conn.storagePoolLookupByName(pool)
collidelist = []
@ -1601,16 +1624,16 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
disk.get_vol_install().pool.name() == poolobj.name()):
collidelist.append(os.path.basename(disk.path))
tmpvol = virtinst.StorageVolume(guest.conn)
tmpvol = StorageVolume(guest.conn)
tmpvol.pool = poolobj
if fmt is None and tmpvol.file_type == tmpvol.TYPE_FILE:
fmt = _default_image_file_format(guest.conn)
ext = virtinst.StorageVolume.get_file_extension_for_format(fmt)
vname = virtinst.StorageVolume.find_free_name(
ext = StorageVolume.get_file_extension_for_format(fmt)
vname = StorageVolume.find_free_name(
poolobj, guest.name, suffix=ext, collidelist=collidelist)
volinst = virtinst.VirtualDisk.build_vol_install(
volinst = VirtualDisk.build_vol_install(
guest.conn, vname, poolobj, size, sparse)
if fmt:
if not volinst.supports_property("format"):
@ -1627,16 +1650,16 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
logging.debug("Parsed volume: as pool='%s' vol='%s'",
voltuple[0], voltuple[1])
if voltuple[0] == "default":
virtinst.StoragePool.build_default_pool(guest.conn)
StoragePool.build_default_pool(guest.conn)
volobj = virtinst.VirtualDisk.lookup_vol_object(guest.conn, voltuple)
volobj = VirtualDisk.lookup_vol_object(guest.conn, voltuple)
return abspath, volinst, volobj
class ParserDisk(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualDisk
self.devclass = VirtualDisk
self.remove_first = "path"
def noset_cb(opts, inst, cliname, val):
@ -1739,7 +1762,7 @@ parse_disk = ParserDisk("disk").parse
class ParserNetwork(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualNetworkInterface
self.devclass = VirtualNetworkInterface
self.remove_first = "type"
def set_mac_cb(opts, inst, cliname, val):
@ -1782,10 +1805,10 @@ class ParserNetwork(VirtCLIParser):
opts = optsobj.opts
if "type" not in opts:
if "network" in opts:
opts["type"] = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL
opts["type"] = VirtualNetworkInterface.TYPE_VIRTUAL
opts["source"] = opts.pop("network")
elif "bridge" in opts:
opts["type"] = virtinst.VirtualNetworkInterface.TYPE_BRIDGE
opts["type"] = VirtualNetworkInterface.TYPE_BRIDGE
opts["source"] = opts.pop("bridge")
return VirtCLIParser._parse(self, optsobj, inst)
@ -1797,18 +1820,18 @@ class ParserNetwork(VirtCLIParser):
class ParserGraphics(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualGraphics
self.devclass = VirtualGraphics
self.remove_first = "type"
def set_keymap_cb(opts, inst, cliname, val):
ignore = opts
ignore = cliname
from virtinst import hostkeymap
from . import hostkeymap
if not val:
val = None
elif val.lower() == "local":
val = virtinst.VirtualGraphics.KEYMAP_LOCAL
val = VirtualGraphics.KEYMAP_LOCAL
elif val.lower() == "none":
val = None
else:
@ -1848,7 +1871,7 @@ class ParserGraphics(VirtCLIParser):
class ParserController(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualController
self.devclass = VirtualController
self.remove_first = "type"
self.set_param("type", "type")
@ -1863,7 +1886,7 @@ class ParserController(VirtCLIParser):
def _parse(self, opts, inst):
if opts.fullopts == "usb2":
return virtinst.VirtualController.get_usb2_controllers(inst.conn)
return VirtualController.get_usb2_controllers(inst.conn)
elif opts.fullopts == "usb3":
inst.type = "usb"
inst.model = "nec-xhci"
@ -1877,7 +1900,7 @@ class ParserController(VirtCLIParser):
class ParserSmartcard(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualSmartCardDevice
self.devclass = VirtualSmartCardDevice
self.remove_first = "mode"
self.check_none = True
@ -1891,7 +1914,7 @@ class ParserSmartcard(VirtCLIParser):
class ParserRedir(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualRedirDevice
self.devclass = VirtualRedirDevice
self.remove_first = "bus"
self.set_param("bus", "bus")
@ -1917,7 +1940,7 @@ class ParserRedir(VirtCLIParser):
class ParserTPM(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualTPMDevice
self.devclass = VirtualTPMDevice
self.remove_first = "type"
self.check_none = True
@ -1937,7 +1960,7 @@ class ParserTPM(VirtCLIParser):
class ParserRNG(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualRNGDevice
self.devclass = VirtualRNGDevice
self.remove_first = "type"
self.check_none = True
@ -2006,7 +2029,7 @@ class ParserRNG(VirtCLIParser):
class ParserWatchdog(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualWatchdog
self.devclass = VirtualWatchdog
self.remove_first = "model"
self.set_param("model", "model")
@ -2019,7 +2042,7 @@ class ParserWatchdog(VirtCLIParser):
class ParserMemballoon(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualMemballoon
self.devclass = VirtualMemballoon
self.remove_first = "model"
self.set_param("model", "model")
@ -2031,7 +2054,7 @@ class ParserMemballoon(VirtCLIParser):
class ParserPanic(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualPanicDevice
self.devclass = VirtualPanicDevice
self.remove_first = "iobase"
def set_iobase_cb(opts, inst, cliname, val):
@ -2130,19 +2153,19 @@ class _ParserChar(VirtCLIParser):
class ParserSerial(_ParserChar):
devclass = virtinst.VirtualSerialDevice
devclass = VirtualSerialDevice
class ParserParallel(_ParserChar):
devclass = virtinst.VirtualParallelDevice
devclass = VirtualParallelDevice
class ParserChannel(_ParserChar):
devclass = virtinst.VirtualChannelDevice
devclass = VirtualChannelDevice
class ParserConsole(_ParserChar):
devclass = virtinst.VirtualConsoleDevice
devclass = VirtualConsoleDevice
########################
@ -2151,7 +2174,7 @@ class ParserConsole(_ParserChar):
class ParserFilesystem(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualFilesystem
self.devclass = VirtualFilesystem
self.remove_first = ["source", "target"]
self.set_param("type", "type")
@ -2166,7 +2189,7 @@ class ParserFilesystem(VirtCLIParser):
class ParserVideo(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualVideoDevice
self.devclass = VirtualVideoDevice
self.remove_first = "model"
self.set_param("model", "model", ignore_default=True)
@ -2178,7 +2201,7 @@ class ParserVideo(VirtCLIParser):
class ParserSound(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualAudio
self.devclass = VirtualAudio
self.remove_first = "model"
self.set_param("model", "model", ignore_default=True)
@ -2196,13 +2219,13 @@ class ParserSound(VirtCLIParser):
class ParserHostdev(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualHostDevice
self.devclass = VirtualHostDevice
self.remove_first = "name"
def set_name_cb(opts, inst, cliname, val):
ignore = opts
ignore = cliname
val = virtinst.NodeDevice.lookupNodeName(inst.conn, val)
val = NodeDevice.lookupNodeName(inst.conn, val)
inst.set_from_nodedev(val)
self.set_param(None, "name", setter_cb=set_name_cb)

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class _ClockTimer(XMLBuilder):

View File

@ -26,11 +26,11 @@ import os
import urlgrabber.progress as progress
import libvirt
from virtinst import Guest
from virtinst import VirtualNetworkInterface
from virtinst import VirtualDisk
from virtinst import StorageVolume
from virtinst import util
from . import util
from .guest import Guest
from .deviceinterface import VirtualNetworkInterface
from .devicedisk import VirtualDisk
from .storage import StorageVolume
class Cloner(object):

View File

@ -22,14 +22,13 @@ import weakref
import libvirt
from virtinst import CapabilitiesParser
from virtinst import Guest
from virtinst import StoragePool
from virtinst import StorageVolume
from virtinst import pollhelpers
from virtinst import support
from virtinst import util
from virtinst.cli import VirtOptionString
from . import pollhelpers
from . import support
from . import util
from . import capabilities as CapabilitiesParser
from .cli import VirtOptionString
from .guest import Guest
from .storage import StoragePool, StorageVolume
_virtinst_uri_magic = "__virtinst_test__"

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
class CPUFeature(XMLBuilder):

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class VirtualDeviceAlias(XMLBuilder):

View File

@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualAudio(VirtualDevice):

View File

@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class _VirtualCharDevice(VirtualDevice):

View File

@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualController(VirtualDevice):

View File

@ -28,10 +28,10 @@ import re
import urlgrabber.progress as progress
from virtinst import diskbackend
from virtinst import util
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from . import diskbackend
from . import util
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
def _qemu_sanitize_drvtype(phystype, fmt, manual_format=False):

View File

@ -19,8 +19,8 @@
import os
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualFilesystem(VirtualDevice):

View File

@ -19,8 +19,8 @@
import os
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
def _get_mode_prop(channel_type):
@ -81,7 +81,7 @@ class VirtualGraphics(VirtualDevice):
"""
Return a list of valid keymap values.
"""
from virtinst import hostkeymap
from . import hostkeymap
orig_list = hostkeymap.keytable.values()
sort_list = []
@ -122,7 +122,7 @@ class VirtualGraphics(VirtualDevice):
return None
if self._local_keymap == -1:
from virtinst import hostkeymap
from . import hostkeymap
self._local_keymap = hostkeymap.default_keymap()
return self._local_keymap

View File

@ -17,9 +17,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst import NodeDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .nodedev import NodeDevice
from .xmlbuilder import XMLProperty
class VirtualHostDevice(VirtualDevice):

View File

@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualInputDevice(VirtualDevice):

View File

@ -20,9 +20,9 @@
import logging
import random
from virtinst import util
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from . import util
from .device import VirtualDevice
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
def _random_mac(conn):

View File

@ -18,8 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualMemballoon(VirtualDevice):

View File

@ -18,8 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualPanicDevice(VirtualDevice):

View File

@ -19,8 +19,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualRedirDevice(VirtualDevice):

View File

@ -18,8 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualRNGDevice(VirtualDevice):

View File

@ -19,8 +19,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualSmartCardDevice(VirtualDevice):

View File

@ -22,8 +22,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualTPMDevice(VirtualDevice):

View File

@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualVideoDevice(VirtualDevice):

View File

@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst import VirtualDevice
from virtinst.xmlbuilder import XMLProperty
from .device import VirtualDevice
from .xmlbuilder import XMLProperty
class VirtualWatchdog(VirtualDevice):

View File

@ -24,8 +24,8 @@ import statvfs
import libvirt
from virtinst import StoragePool, StorageVolume
from virtinst import util
from . import util
from .storage import StoragePool, StorageVolume
def check_if_path_managed(conn, path):

View File

@ -25,12 +25,12 @@ import tempfile
import urlgrabber
from virtinst import StoragePool, StorageVolume
from virtinst import util
from virtinst import Installer
from virtinst import VirtualDisk
from virtinst import urlfetcher
from virtinst import osdict
from . import osdict
from . import urlfetcher
from . import util
from .devicedisk import VirtualDisk
from .installer import Installer
from .storage import StoragePool, StorageVolume
def _is_url(conn, url):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class DomainBlkiotune(XMLBuilder):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class DomainFeatures(XMLBuilder):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class DomainMemorybacking(XMLBuilder):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class DomainMemorytune(XMLBuilder):

View File

@ -19,7 +19,7 @@
import re
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
def get_phy_cpus(conn):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class DomainResource(XMLBuilder):

View File

@ -26,25 +26,31 @@ import libvirt
from virtcli import cliconfig
import virtinst
from virtinst import util
from virtinst import support
from virtinst import OSXML
from virtinst import VirtualDevice
from virtinst import Clock
from virtinst import Seclabel
from virtinst import CPU
from virtinst import DomainNumatune
from virtinst import DomainMemorytune
from virtinst import DomainMemorybacking
from virtinst import DomainBlkiotune
from virtinst import DomainFeatures
from virtinst import DomainResource
from virtinst import PM
from virtinst import IdMap
from virtinst.xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
from virtinst import osdict
from . import osdict
from . import util
from . import support
from .clock import Clock
from .cpu import CPU
from .device import VirtualDevice
from .deviceaudio import VirtualAudio
from .devicechar import VirtualChannelDevice, VirtualConsoleDevice
from .devicecontroller import VirtualController
from .devicegraphics import VirtualGraphics
from .deviceinput import VirtualInputDevice
from .deviceredirdev import VirtualRedirDevice
from .devicevideo import VirtualVideoDevice
from .distroinstaller import DistroInstaller
from .domainblkiotune import DomainBlkiotune
from .domainfeatures import DomainFeatures
from .domainmemorybacking import DomainMemorybacking
from .domainmemorytune import DomainMemorytune
from .domainnumatune import DomainNumatune
from .domainresource import DomainResource
from .idmap import IdMap
from .osxml import OSXML
from .pm import PM
from .seclabel import Seclabel
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
class Guest(XMLBuilder):
@ -122,7 +128,7 @@ class Guest(XMLBuilder):
# The libvirt virDomain object we 'Create'
self.domain = None
self.installer = virtinst.DistroInstaller(self.conn)
self.installer = DistroInstaller(self.conn)
######################
@ -534,14 +540,14 @@ class Guest(XMLBuilder):
return
if self.get_devices("input"):
return
self.add_device(virtinst.VirtualInputDevice(self.conn))
self.add_device(VirtualInputDevice(self.conn))
def add_default_sound_device(self):
if not self.os.is_hvm():
return
if not self.os.is_x86():
return
self.add_device(virtinst.VirtualAudio(self.conn))
self.add_device(VirtualAudio(self.conn))
def add_default_console_device(self):
if self.skip_default_console:
@ -551,7 +557,7 @@ class Guest(XMLBuilder):
if self.get_devices("console") or self.get_devices("serial"):
return
dev = virtinst.VirtualConsoleDevice(self.conn)
dev = VirtualConsoleDevice(self.conn)
dev.type = dev.TYPE_PTY
if (self.os.is_x86() and
@ -569,7 +575,7 @@ class Guest(XMLBuilder):
return
if not self.get_devices("graphics"):
return
self.add_device(virtinst.VirtualVideoDevice(self.conn))
self.add_device(VirtualVideoDevice(self.conn))
def add_default_usb_controller(self):
if self.os.is_container():
@ -581,7 +587,7 @@ class Guest(XMLBuilder):
if not self.conn.check_support(
self.conn.SUPPORT_CONN_DEFAULT_USB2):
return
for dev in virtinst.VirtualController.get_usb2_controllers(self.conn):
for dev in VirtualController.get_usb2_controllers(self.conn):
self.add_device(dev)
def add_default_channels(self):
@ -595,7 +601,7 @@ class Guest(XMLBuilder):
not self.os.is_arm() and
self._lookup_osdict_key("qemu_ga", False) and
self.conn.check_support(self.conn.SUPPORT_CONN_AUTOSOCKET)):
dev = virtinst.VirtualChannelDevice(self.conn)
dev = VirtualChannelDevice(self.conn)
dev.type = "unix"
dev.target_type = "virtio"
dev.target_name = dev.CHANNEL_NAME_QEMUGA
@ -610,7 +616,7 @@ class Guest(XMLBuilder):
return
if self.os.arch not in ["x86_64", "i686", "ppc64", "ia64"]:
return
self.add_device(virtinst.VirtualGraphics(self.conn))
self.add_device(VirtualGraphics(self.conn))
def add_default_devices(self):
self.add_default_graphics()
@ -801,7 +807,7 @@ class Guest(XMLBuilder):
dev.virtual_device_type == "disk" and
not any([cont.address.type == "spapr-vio" for cont in
self.get_devices("controller")])):
ctrl = virtinst.VirtualController(self.conn)
ctrl = VirtualController(self.conn)
ctrl.type = "scsi"
ctrl.address.set_addrstr("spapr-vio")
self.add_device(ctrl)
@ -896,8 +902,8 @@ class Guest(XMLBuilder):
input_type = self._lookup_osdict_key("inputtype", "mouse")
input_bus = self._lookup_osdict_key("inputbus", "ps2")
if self.os.is_xenpv():
input_type = virtinst.VirtualInputDevice.TYPE_MOUSE
input_bus = virtinst.VirtualInputDevice.BUS_XEN
input_type = VirtualInputDevice.TYPE_MOUSE
input_bus = VirtualInputDevice.BUS_XEN
for inp in self.get_devices("input"):
if (inp.type == inp.TYPE_DEFAULT and
@ -943,7 +949,7 @@ class Guest(XMLBuilder):
return
if self.conn.check_support(self.conn.SUPPORT_CONN_CHAR_SPICEVMC):
agentdev = virtinst.VirtualChannelDevice(self.conn)
agentdev = VirtualChannelDevice(self.conn)
agentdev.type = agentdev.TYPE_SPICEVMC
self.add_device(agentdev)
@ -963,7 +969,7 @@ class Guest(XMLBuilder):
return
for ignore in range(4):
dev = virtinst.VirtualRedirDevice(self.conn)
dev = VirtualRedirDevice(self.conn)
dev.bus = "usb"
dev.type = "spicevmc"
self.add_device(dev)

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class IdMap(XMLBuilder):

View File

@ -22,8 +22,8 @@
import os
import logging
import virtinst
from virtinst import OSXML
from .devicedisk import VirtualDisk
from .osxml import OSXML
class Installer(object):
@ -103,7 +103,7 @@ class Installer(object):
return bootorder
def _make_cdrom_dev(self, path, transient=False):
dev = virtinst.VirtualDisk(self.conn)
dev = VirtualDisk(self.conn)
dev.path = path
dev.device = dev.DEVICE_CDROM
dev.read_only = True
@ -256,11 +256,11 @@ class ImportInstaller(Installer):
return self._disk_to_bootdev(disks[0])
def _disk_to_bootdev(self, disk):
if disk.device == virtinst.VirtualDisk.DEVICE_DISK:
if disk.device == VirtualDisk.DEVICE_DISK:
return OSXML.BOOT_DEVICE_HARDDISK
elif disk.device == virtinst.VirtualDisk.DEVICE_CDROM:
elif disk.device == VirtualDisk.DEVICE_CDROM:
return OSXML.BOOT_DEVICE_CDROM
elif disk.device == virtinst.VirtualDisk.DEVICE_FLOPPY:
elif disk.device == VirtualDisk.DEVICE_FLOPPY:
return OSXML.BOOT_DEVICE_FLOPPY
else:
return OSXML.BOOT_DEVICE_HARDDISK

View File

@ -25,8 +25,8 @@ import logging
import libvirt
import ipaddr
from virtinst import util
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from . import util
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class _IPAddress(XMLBuilder):

View File

@ -24,8 +24,8 @@ import logging
import libvirt
from virtinst import util
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from . import util
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class _NetworkDHCPRange(XMLBuilder):

View File

@ -21,8 +21,8 @@ import logging
import libvirt
from virtinst.xmlbuilder import XMLBuilder
from virtinst.xmlbuilder import XMLProperty as OrigXMLProperty
from .xmlbuilder import XMLBuilder
from .xmlbuilder import XMLProperty as OrigXMLProperty
# We had a pre-existing set of parse tests when this was converted to

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
class _InitArg(XMLBuilder):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class PM(XMLBuilder):

View File

@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
from .xmlbuilder import XMLBuilder, XMLProperty
class Seclabel(XMLBuilder):

View File

@ -19,8 +19,8 @@
import libvirt
from virtinst import util
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from . import util
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class _SnapshotDisk(XMLBuilder):

View File

@ -25,8 +25,8 @@ import logging
import libvirt
import urlgrabber
from virtinst.xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from virtinst import util
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
from . import util
DEFAULT_DEV_TARGET = "/dev"

View File

@ -21,7 +21,7 @@
import libvirt
from virtinst import util
from . import util
# Check that command is present in the python bindings, and return the

View File

@ -32,7 +32,7 @@ import urlparse
import urlgrabber.grabber as grabber
from virtinst import osdict
from . import osdict
#########################################################################

View File

@ -26,7 +26,7 @@ import re
import libxml2
from virtinst import util
from . import util
# pylint: disable=protected-access