mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
Fix the last of the pylint messages
If using an older pylint, there are still some complaints about hashlib and Popen, but those aren't our problems.
This commit is contained in:
parent
b8f1bbd3de
commit
3f79fa3919
@ -33,7 +33,7 @@ class TestImageParser(unittest.TestCase):
|
||||
|
||||
basedir = "tests/image-xml/"
|
||||
conn = libvirt.open("test:///default")
|
||||
qemuconn = virtinst.cli._open_test_uri(qemuuri)
|
||||
qemuconn = virtinst.cli.open_test_uri(qemuuri)
|
||||
caps = virtinst.CapabilitiesParser.parse(conn.getCapabilities())
|
||||
qemucaps = virtinst.CapabilitiesParser.parse(qemuconn.getCapabilities())
|
||||
|
||||
|
2
todo.txt
2
todo.txt
@ -4,7 +4,6 @@
|
||||
|
||||
virtinst merge bits:
|
||||
make sure translations actually work when installed
|
||||
merge pylint scripts, make sure there are no warnings
|
||||
break out osdistro bits so we don't need to carry virt-install.pod
|
||||
merge README, reference that we merged virtinst and see that repo for
|
||||
old NEWS, etc.
|
||||
@ -61,7 +60,6 @@ start a spice guest, shrink the window to smaller than guest resolution, scrollb
|
||||
====================
|
||||
|
||||
enable all pep8 bits
|
||||
pylint: drop shell script, stick it in setup.py
|
||||
drop old stuff from both spec files
|
||||
update README
|
||||
virtinst initrd test: drop the big files? just stub em out
|
||||
|
@ -32,6 +32,7 @@ import traceback
|
||||
|
||||
import libvirt
|
||||
import virtinst
|
||||
import virtinst.cli
|
||||
from virtinst import uriutil
|
||||
|
||||
from virtManager import util
|
||||
@ -45,13 +46,6 @@ from virtManager.network import vmmNetwork
|
||||
from virtManager.nodedev import vmmNodeDevice
|
||||
from virtManager.storagepool import vmmStoragePool
|
||||
|
||||
def _is_virtinst_test_uri(uri):
|
||||
try:
|
||||
from virtinst import cli
|
||||
return bool(cli._is_virtinst_test_uri(uri))
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
class vmmConnection(vmmGObject):
|
||||
__gsignals__ = {
|
||||
@ -99,7 +93,8 @@ class vmmConnection(vmmGObject):
|
||||
|
||||
self._caps = None
|
||||
self._caps_xml = None
|
||||
self._is_virtinst_test_uri = _is_virtinst_test_uri(self._uri)
|
||||
self._is_virtinst_test_uri = virtinst.cli.is_virtinst_test_uri(
|
||||
self._uri)
|
||||
|
||||
self.network_capable = None
|
||||
self._storage_capable = None
|
||||
@ -967,13 +962,7 @@ class vmmConnection(vmmGObject):
|
||||
"""
|
||||
if not self._is_virtinst_test_uri:
|
||||
return
|
||||
|
||||
try:
|
||||
from virtinst import cli
|
||||
return cli._open_test_uri(uri)
|
||||
except:
|
||||
logging.exception("Trouble opening test URI")
|
||||
return
|
||||
return virtinst.cli.open_test_uri(uri)
|
||||
|
||||
def open(self, sync=False):
|
||||
if self.state != self.STATE_DISCONNECTED:
|
||||
|
@ -23,8 +23,8 @@ import virtconv.formats as formats
|
||||
import virtconv.vmcfg as vmcfg
|
||||
import virtconv.diskcfg as diskcfg
|
||||
import virtconv.netdevcfg as netdevcfg
|
||||
import virtinst.Guest as Guest
|
||||
import virtinst.ImageParser as ImageParser
|
||||
from virtinst import Guest
|
||||
from virtinst import ImageParser
|
||||
|
||||
from xml.sax.saxutils import escape
|
||||
import re
|
||||
@ -86,7 +86,7 @@ def export_os_params(vm):
|
||||
|
||||
# TODO: Shouldn't be directly using _OS_TYPES here. virt-image libs (
|
||||
# ImageParser?) should handle this info
|
||||
ostype = Guest._OS_TYPES.get(vm.os_type)
|
||||
ostype = Guest._OS_TYPES.get(vm.os_type) # pylint: disable=W0212
|
||||
if ostype:
|
||||
osvariant = ostype.get('variants').get(vm.os_variant)
|
||||
|
||||
|
@ -157,6 +157,9 @@ class DistroInstaller(Installer.Installer):
|
||||
def __init__(self, type="xen", location=None,
|
||||
extraargs=None, os_type=None,
|
||||
conn=None, caps=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
Installer.Installer.__init__(self, type, location, extraargs,
|
||||
os_type, conn=conn, caps=caps)
|
||||
|
||||
@ -367,8 +370,13 @@ class DistroInstaller(Installer.Installer):
|
||||
not os.path.isdir(self.location)):
|
||||
|
||||
device = VirtualDisk.DEVICE_CDROM
|
||||
if (self.is_xenpv() and
|
||||
not guest._lookup_osdict_key('pv_cdrom_install')):
|
||||
|
||||
# pylint: disable=W0212
|
||||
# Access to protected member lookup_osdict_key
|
||||
can_cdrom = guest._lookup_osdict_key('pv_cdrom_install')
|
||||
# pylint: enable=W0212
|
||||
|
||||
if self.is_xenpv() and can_cdrom:
|
||||
device = VirtualDisk.DEVICE_DISK
|
||||
|
||||
disk = VirtualDisk(conn=guest.conn,
|
||||
|
@ -69,6 +69,9 @@ class DomainFeatures(XMLBuilderDomain.XMLBuilderDomain):
|
||||
|
||||
|
||||
def _get_xml_config(self, defaults=None):
|
||||
# pylint: disable=W0221
|
||||
# Argument number differs from overridden method
|
||||
|
||||
if not defaults:
|
||||
defaults = {}
|
||||
ret = ""
|
||||
|
@ -172,6 +172,8 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
||||
|
||||
def __init__(self, type=None, connection=None, hypervisorURI=None,
|
||||
installer=None, parsexml=None, caps=None, conn=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
# Set up the connection, since it is fundamental for other init
|
||||
conn = conn or connection
|
||||
@ -219,7 +221,11 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
||||
self._default_input_device = None
|
||||
self._default_console_device = None
|
||||
|
||||
# pylint: disable=W0212
|
||||
# Access to protected member _get_caps
|
||||
caps = caps or (self._installer and self._installer._get_caps())
|
||||
# pylint: enable=W0212
|
||||
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
caps=caps)
|
||||
if self._is_parse():
|
||||
@ -581,14 +587,14 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
||||
|
||||
# If user adds a device conflicting with a default assigned device
|
||||
# remove the default
|
||||
if (dev.virtual_device_type == VirtualDevice.VIRTUAL_DEV_INPUT and
|
||||
if (devtype == VirtualDevice.VIRTUAL_DEV_INPUT and
|
||||
self._default_input_device):
|
||||
if self._default_input_device in self.get_all_devices():
|
||||
self.remove_device(self._default_input_device)
|
||||
self._default_input_device = None
|
||||
|
||||
if (dev.virtual_device_type in [VirtualDevice.VIRTUAL_DEV_CONSOLE,
|
||||
VirtualDevice.VIRTUAL_DEV_SERIAL] and
|
||||
if (devtype in [VirtualDevice.VIRTUAL_DEV_CONSOLE,
|
||||
VirtualDevice.VIRTUAL_DEV_SERIAL] and
|
||||
self._default_console_device):
|
||||
if self._default_console_device in self.get_all_devices():
|
||||
self.remove_device(self._default_console_device)
|
||||
@ -899,6 +905,9 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
||||
this.)
|
||||
@type disk_boot: C{bool}
|
||||
"""
|
||||
# pylint: disable=W0221
|
||||
# Argument number differs from overridden method
|
||||
|
||||
# We do a shallow copy of the device list here, and set the defaults.
|
||||
# This way, default changes aren't persistent, and we don't need
|
||||
# to worry about when to call set_defaults
|
||||
|
@ -83,6 +83,9 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
||||
def __init__(self, type="xen", location=None,
|
||||
extraargs=None, os_type=None, conn=None,
|
||||
parsexml=None, parsexmlnode=None, caps=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
parsexmlnode, caps=caps)
|
||||
|
||||
@ -356,6 +359,9 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
||||
'post-install' phase.
|
||||
@type isinstall: C{bool}
|
||||
"""
|
||||
# pylint: disable=W0221
|
||||
# Argument number differs from overridden method
|
||||
|
||||
if isinstall:
|
||||
bootconfig = self._install_bootconfig
|
||||
else:
|
||||
@ -485,6 +491,7 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
||||
|
||||
return gobj
|
||||
|
||||
|
||||
class ContainerInstaller(Installer):
|
||||
def prepare(self, guest, meter):
|
||||
ignore = guest
|
||||
@ -497,6 +504,3 @@ class ContainerInstaller(Installer):
|
||||
|
||||
def has_install_phase(self):
|
||||
return False
|
||||
|
||||
# Back compat
|
||||
Installer.get_install_xml = Installer.get_xml_config
|
||||
|
@ -349,7 +349,10 @@ class StoragePool(StorageObject):
|
||||
pool_list_from_sources = staticmethod(pool_list_from_sources)
|
||||
|
||||
def __init__(self, conn, name, type, target_path=None, uuid=None):
|
||||
StorageObject.__init__(self, object_type=StorageObject.TYPE_POOL, \
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
StorageObject.__init__(self, object_type=StorageObject.TYPE_POOL,
|
||||
name=name, conn=conn)
|
||||
|
||||
if type not in self.get_pool_types():
|
||||
@ -545,6 +548,9 @@ class FilesystemPool(StoragePool):
|
||||
|
||||
def __init__(self, conn, name, source_path=None, target_path=None,
|
||||
format="auto", uuid=None, perms=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'format', but it matches the XML so keep it
|
||||
|
||||
StoragePool.__init__(self, name=name, type=StoragePool.TYPE_FS,
|
||||
target_path=target_path, uuid=uuid, conn=conn)
|
||||
|
||||
@ -603,6 +609,9 @@ class NetworkFilesystemPool(StoragePool):
|
||||
|
||||
def __init__(self, conn, name, source_path=None, host=None,
|
||||
target_path=None, format="auto", uuid=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'format', but it matches the XML so keep it
|
||||
|
||||
StoragePool.__init__(self, name=name, type=StoragePool.TYPE_NETFS,
|
||||
uuid=uuid, target_path=target_path, conn=conn)
|
||||
|
||||
@ -762,6 +771,9 @@ class DiskPool(StoragePool):
|
||||
|
||||
def __init__(self, conn, name, source_path=None, target_path=None,
|
||||
format="auto", uuid=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'format', but it matches the XML so keep it
|
||||
|
||||
StoragePool.__init__(self, name=name, type=StoragePool.TYPE_DISK,
|
||||
uuid=uuid, target_path=target_path, conn=conn)
|
||||
self.format = format
|
||||
@ -979,11 +991,11 @@ class StorageVolume(StorageObject):
|
||||
pool = StorageVolume.lookup_pool_by_name(pool_name=pool_name,
|
||||
conn=conn)
|
||||
self._pool = None
|
||||
|
||||
self.pool = pool
|
||||
poolconn = self.pool._conn # pylint: disable=W0212
|
||||
|
||||
StorageObject.__init__(self, object_type=StorageObject.TYPE_VOLUME,
|
||||
name=name, conn=self.pool._conn)
|
||||
name=name, conn=poolconn)
|
||||
self._allocation = None
|
||||
self._capacity = None
|
||||
self._format = None
|
||||
@ -1130,7 +1142,9 @@ class StorageVolume(StorageObject):
|
||||
|
||||
if not isinstance(vol, libvirt.virStorageVol):
|
||||
raise ValueError(_("input_vol must be a virStorageVol"))
|
||||
if not is_create_vol_from_supported(self.pool._conn):
|
||||
|
||||
poolconn = self.pool._conn # pylint: disable=W0212
|
||||
if not is_create_vol_from_supported(poolconn):
|
||||
raise ValueError(_("Creating storage from an existing volume is"
|
||||
" not supported by this libvirt version."))
|
||||
self._input_vol = vol
|
||||
@ -1302,6 +1316,9 @@ class FileVolume(StorageVolume):
|
||||
|
||||
def __init__(self, name, capacity, pool=None, pool_name=None, conn=None,
|
||||
format="raw", allocation=None, perms=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'format', but it matches the XML so keep it
|
||||
|
||||
StorageVolume.__init__(self, name=name, pool=pool, pool_name=pool_name,
|
||||
allocation=allocation, capacity=capacity,
|
||||
conn=conn)
|
||||
|
@ -282,6 +282,8 @@ class VirtualDisk(VirtualDevice):
|
||||
__init__ and setting all properties performs lots of validation,
|
||||
and will throw ValueError's if problems are found.
|
||||
"""
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
_virtual_device_type = VirtualDevice.VIRTUAL_DEV_DISK
|
||||
|
||||
@ -1471,6 +1473,9 @@ class VirtualDisk(VirtualDevice):
|
||||
takes precedence.
|
||||
@type disknode: C{str}
|
||||
"""
|
||||
# pylint: disable=W0221
|
||||
# Argument number differs from overridden method
|
||||
|
||||
typeattr = self.type
|
||||
if self.type == VirtualDisk.TYPE_BLOCK:
|
||||
typeattr = 'dev'
|
||||
|
@ -94,9 +94,10 @@ class VirtualGraphics(VirtualDevice):
|
||||
keymap=KEYMAP_DEFAULT, conn=None, parsexml=None,
|
||||
parsexmlnode=None, tlsPort=-1, channels=None,
|
||||
caps=None, passwdValidTo=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
VirtualDevice.__init__(self, conn,
|
||||
parsexml, parsexmlnode, caps)
|
||||
VirtualDevice.__init__(self, conn, parsexml, parsexmlnode, caps)
|
||||
|
||||
self._type = None
|
||||
self._port = None
|
||||
|
@ -145,6 +145,9 @@ class VirtualNetworkInterface(VirtualDevice):
|
||||
def __init__(self, macaddr=None, type=TYPE_BRIDGE, bridge=None,
|
||||
network=None, model=None, conn=None,
|
||||
parsexml=None, parsexmlnode=None, caps=None):
|
||||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
VirtualDevice.__init__(self, conn, parsexml, parsexmlnode, caps)
|
||||
|
||||
self._network = None
|
||||
|
@ -223,10 +223,10 @@ def setupLogging(appname, debug=False, do_quiet=False):
|
||||
|
||||
_virtinst_uri_magic = "__virtinst_test__"
|
||||
|
||||
def _is_virtinst_test_uri(uri):
|
||||
def is_virtinst_test_uri(uri):
|
||||
return uri and uri.startswith(_virtinst_uri_magic)
|
||||
|
||||
def _open_test_uri(uri):
|
||||
def open_test_uri(uri):
|
||||
"""
|
||||
This hack allows us to fake various drivers via passing a magic
|
||||
URI string to virt-*. Helps with testing
|
||||
@ -318,8 +318,8 @@ def getConnection(uri):
|
||||
fail(_("Must be root to create Xen guests"))
|
||||
|
||||
# Hack to facilitate virtinst unit testing
|
||||
if _is_virtinst_test_uri(uri):
|
||||
return _open_test_uri(uri)
|
||||
if is_virtinst_test_uri(uri):
|
||||
return open_test_uri(uri)
|
||||
|
||||
logging.debug("Requesting libvirt URI %s", (uri or "default"))
|
||||
conn = open_connection(uri)
|
||||
|
Loading…
Reference in New Issue
Block a user