summaryrefslogtreecommitdiff
path: root/virtinst
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2019-06-07 16:06:52 -0400
committerCole Robinson <crobinso@redhat.com>2019-06-07 16:26:03 -0400
commitf85e6def55d2c06f1b1f33c50d12c13406c48cb1 (patch)
treedabdb88498e3a30942e40e927b6b115e2f7a048a /virtinst
parent566a4681a81b5ddba275c0953b5edc08fe7f472b (diff)
downloadvirt-manager-f85e6def55d2c06f1b1f33c50d12c13406c48cb1.tar.gz
support: Convert callers to the new format
Diffstat (limited to 'virtinst')
-rw-r--r--virtinst/cli.py11
-rw-r--r--virtinst/connection.py12
-rw-r--r--virtinst/devices/controller.py4
-rw-r--r--virtinst/devices/disk.py3
-rw-r--r--virtinst/devices/graphics.py9
-rw-r--r--virtinst/diskbackend.py2
-rw-r--r--virtinst/domain/clock.py2
-rw-r--r--virtinst/domain/features.py2
-rw-r--r--virtinst/domain/pm.py2
-rw-r--r--virtinst/domcapabilities.py3
-rw-r--r--virtinst/guest.py16
-rw-r--r--virtinst/nodedev.py2
-rw-r--r--virtinst/pollhelpers.py18
-rw-r--r--virtinst/storage.py12
14 files changed, 35 insertions, 63 deletions
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 7ba6b211..8ac38709 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2720,7 +2720,7 @@ def _add_char_source_args(cls, prefix=""):
##################
def _default_image_file_format(conn):
- if conn.check_support(conn.SUPPORT_CONN_DEFAULT_QCOW2):
+ if conn.support.conn_default_qcow2():
return "qcow2"
return "raw"
@@ -3160,14 +3160,12 @@ class ParserGraphics(VirtCLIParser):
if inst.conn.is_qemu() and inst.gl:
if inst.type != "spice":
logging.warning("graphics type=%s does not support GL", inst.type)
- elif not inst.conn.check_support(
- inst.conn.SUPPORT_CONN_SPICE_GL):
+ elif not inst.conn.support.conn_spice_gl():
logging.warning("qemu/libvirt version may not support spice GL")
if inst.conn.is_qemu() and inst.rendernode:
if inst.type != "spice":
logging.warning("graphics type=%s does not support rendernode", inst.type)
- elif not inst.conn.check_support(
- inst.conn.SUPPORT_CONN_SPICE_RENDERNODE):
+ elif not inst.conn.support.conn_spice_rendernode():
logging.warning("qemu/libvirt version may not support rendernode")
return ret
@@ -3735,8 +3733,7 @@ class ParserVideo(VirtCLIParser):
if inst.model != "virtio":
logging.warning("video model=%s does not support accel3d",
inst.model)
- elif not inst.conn.check_support(
- inst.conn.SUPPORT_CONN_VIDEO_VIRTIO_ACCEL3D):
+ elif not inst.conn.support.conn_video_virtio_accel_3d():
logging.warning("qemu/libvirt version may not support "
"virtio accel3d")
diff --git a/virtinst/connection.py b/virtinst/connection.py
index 57d74ffa..af3fb459 100644
--- a/virtinst/connection.py
+++ b/virtinst/connection.py
@@ -78,9 +78,6 @@ class VirtinstConnection(object):
if attr in self.__dict__:
return self.__dict__[attr]
- if attr.startswith("SUPPORT_"):
- return getattr(self.support, attr.split("_", 1)[1].lower())
-
# Proxy virConnect API calls
libvirtconn = self.__dict__.get("_libvirtconn")
return getattr(libvirtconn, attr)
@@ -382,14 +379,7 @@ class VirtinstConnection(object):
# Support check helpers #
#########################
- def check_support(self, features, data=None):
- for f in util.listify(features):
- # 'and' condition over the feature list
- if not f(data):
- return False
- return True
-
def support_remote_url_install(self):
if self._magic_uri:
return False
- return self.check_support(self.SUPPORT_CONN_STREAM)
+ return self.support.conn_stream()
diff --git a/virtinst/devices/controller.py b/virtinst/devices/controller.py
index 39107be1..d518c63f 100644
--- a/virtinst/devices/controller.py
+++ b/virtinst/devices/controller.py
@@ -79,9 +79,9 @@ class DeviceController(Device):
ctrl = DeviceController(conn)
ctrl.type = "usb"
ctrl.model = "nec-xhci"
- if conn.check_support(conn.SUPPORT_CONN_QEMU_XHCI):
+ if conn.support.conn_qemu_xhci():
ctrl.model = "qemu-xhci"
- if conn.check_support(conn.SUPPORT_CONN_USB3_PORTS):
+ if conn.support.conn_usb3_ports():
# 15 is the max ports qemu supports, might as well
# Add as many as possible
ctrl.ports = 15
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index 93feb688..e78cd2b0 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -437,8 +437,7 @@ class DeviceDisk(Device):
# If type block, use name=phy. Otherwise do the same as qemu
if self.conn.is_xen() and self.type == self.TYPE_BLOCK:
return self.DRIVER_NAME_PHY
- if self.conn.check_support(
- self.conn.SUPPORT_CONN_DISK_DRIVER_NAME_QEMU):
+ if self.conn.support.conn_disk_driver_name_qemu():
return self.DRIVER_NAME_QEMU
return None
diff --git a/virtinst/devices/graphics.py b/virtinst/devices/graphics.py
index 6ab31659..2783ab7c 100644
--- a/virtinst/devices/graphics.py
+++ b/virtinst/devices/graphics.py
@@ -180,8 +180,7 @@ class DeviceGraphics(Device):
self.autoport = None
self.socket = None
- if self.conn.check_support(
- self.conn.SUPPORT_CONN_GRAPHICS_LISTEN_NONE):
+ if self.conn.support.conn_graphics_listen_none():
obj = self.listens.add_new()
obj.type = "none"
@@ -250,14 +249,12 @@ class DeviceGraphics(Device):
return None
def _default_spice_gl(self, _guest):
- if not self.conn.check_support(
- self.conn.SUPPORT_CONN_SPICE_GL):
+ if not self.conn.support.conn_spice_gl():
raise ValueError(_("Host does not support spice GL"))
# If spice GL but rendernode wasn't specified, hardcode
# the first one
- if not self.rendernode and self.conn.check_support(
- self.conn.SUPPORT_CONN_SPICE_RENDERNODE):
+ if not self.rendernode and self.conn.support.conn_spice_rendernode():
for nodedev in self.conn.fetch_all_nodedevs():
if not nodedev.is_drm_render():
continue
diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
index 986f0ab6..a6c8dc33 100644
--- a/virtinst/diskbackend.py
+++ b/virtinst/diskbackend.py
@@ -123,7 +123,7 @@ def manage_path(conn, path):
"""
If path is not managed, try to create a storage pool to probe the path
"""
- if not conn.check_support(conn.SUPPORT_CONN_STORAGE):
+ if not conn.support.conn_storage():
return None, None
if not path:
return None, None
diff --git a/virtinst/domain/clock.py b/virtinst/domain/clock.py
index f3868bae..f61a51ad 100644
--- a/virtinst/domain/clock.py
+++ b/virtinst/domain/clock.py
@@ -64,7 +64,7 @@ class DomainClock(XMLBuilder):
hpet.present = False
if (guest.hyperv_supported() and
- self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_CLOCK)):
+ self.conn.support.conn_hyperv_clock()):
hyperv = self.timers.add_new()
hyperv.name = "hypervclock"
hyperv.present = True
diff --git a/virtinst/domain/features.py b/virtinst/domain/features.py
index ae7ba2ff..d5590ab0 100644
--- a/virtinst/domain/features.py
+++ b/virtinst/domain/features.py
@@ -72,7 +72,7 @@ class DomainFeatures(XMLBuilder):
self.pae = capsinfo.guest.supports_pae()
if (guest.hyperv_supported() and
- self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_VAPIC)):
+ self.conn.support.conn_hyperv_vapic()):
if self.hyperv_relaxed is None:
self.hyperv_relaxed = True
if self.hyperv_vapic is None:
diff --git a/virtinst/domain/pm.py b/virtinst/domain/pm.py
index 975ed30f..b0fbad58 100644
--- a/virtinst/domain/pm.py
+++ b/virtinst/domain/pm.py
@@ -27,7 +27,7 @@ class DomainPm(XMLBuilder):
# We've been disabling this in virt-manager for a while, but lets
# do it here too for consistency.
if (guest.os.is_x86() and
- self.conn.check_support(self.conn.SUPPORT_CONN_PM_DISABLE)):
+ self.conn.support.conn_pm_disable()):
if self.suspend_to_mem is None:
self.suspend_to_mem = False
if self.suspend_to_disk is None:
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index acc91f81..7295d68a 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -141,8 +141,7 @@ class DomainCapabilities(XMLBuilder):
@staticmethod
def build_from_params(conn, emulator, arch, machine, hvtype):
xml = None
- if conn.check_support(
- conn.SUPPORT_CONN_DOMAIN_CAPABILITIES):
+ if conn.support.conn_domain_capabilities():
try:
xml = conn.getDomainCapabilities(emulator, arch,
machine, hvtype)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 82a2711a..64705fe6 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -715,7 +715,7 @@ class Guest(XMLBuilder):
if (self.os.is_x86() and
self.conn.is_qemu() and
"q35" in capsinfo.machines and
- self.conn.check_support(self.conn.SUPPORT_QEMU_Q35_DEFAULT) and
+ self.conn.support.qemu_q35_default() and
self.osinfo.supports_chipset_q35()):
self.os.machine = "q35"
return
@@ -815,7 +815,7 @@ class Guest(XMLBuilder):
if not self.conn.is_qemu() and not self.conn.is_test():
return
- qemu_usb3 = self.conn.check_support(self.conn.SUPPORT_CONN_QEMU_XHCI)
+ qemu_usb3 = self.conn.support.conn_qemu_xhci()
usb2 = False
usb3 = False
if self.os.is_x86():
@@ -824,16 +824,14 @@ class Guest(XMLBuilder):
elif self.os.is_arm_machvirt():
# For machvirt, we always assume OS supports usb3
if (qemu_usb3 and
- self.conn.check_support(
- self.conn.SUPPORT_CONN_MACHVIRT_PCI_DEFAULT)):
+ self.conn.support.conn_machvirt_pci_default()):
usb3 = True
elif self.os.is_riscv_virt():
# For RISC-V we can assume the guest OS supports USB3, but we
# have to make sure libvirt and QEMU are new enough to be using
# PCI by default
if (qemu_usb3 and
- self.conn.check_support(
- self.conn.SUPPORT_CONN_RISCV_VIRT_PCI_DEFAULT)):
+ self.conn.support.conn_riscv_virt_pci_default()):
usb3 = True
elif self.os.is_pseries():
# For pseries, we always assume OS supports usb3
@@ -859,7 +857,7 @@ class Guest(XMLBuilder):
if (self.conn.is_qemu() and
self._supports_virtioserial() and
- self.conn.check_support(self.conn.SUPPORT_CONN_AUTOSOCKET)):
+ self.conn.support.conn_autosocket()):
dev = DeviceChannel(self.conn)
dev.type = "unix"
dev.target_type = "virtio"
@@ -891,7 +889,7 @@ class Guest(XMLBuilder):
if (self.conn.is_qemu() and
self.osinfo.supports_virtiorng() and
- self.conn.check_support(self.conn.SUPPORT_CONN_RNG_URANDOM)):
+ self.conn.support.conn_rng_urandom()):
dev = DeviceRng(self.conn)
dev.type = "random"
dev.device = "/dev/urandom"
@@ -967,7 +965,7 @@ class Guest(XMLBuilder):
if (self.features.vmport is None and
self.os.is_x86() and
- self.conn.check_support(self.conn.SUPPORT_CONN_VMPORT)):
+ self.conn.support.conn_vmport()):
self.features.vmport = False
self._add_spice_channels()
diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py
index 925dc9a9..245a419b 100644
--- a/virtinst/nodedev.py
+++ b/virtinst/nodedev.py
@@ -58,7 +58,7 @@ class NodeDevice(XMLBuilder):
:returns: NodeDevice instance
"""
- if not conn.check_support(conn.SUPPORT_CONN_NODEDEV):
+ if not conn.support.conn_nodedev():
raise ValueError(_("Connection does not support host device "
"enumeration."))
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index 37087abd..8db2ebb6 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -102,8 +102,7 @@ def _old_poll_helper(origmap, typename,
def fetch_nets(backend, origmap, build_func):
name = "network"
- if backend.check_support(
- backend.SUPPORT_CONN_LISTALLNETWORKS) and not FORCE_OLD_POLL:
+ if backend.support.conn_listallnetworks() and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name,
backend.listAllNetworks, build_func)
else:
@@ -119,8 +118,7 @@ def fetch_nets(backend, origmap, build_func):
def fetch_pools(backend, origmap, build_func):
name = "pool"
- if backend.check_support(
- backend.SUPPORT_CONN_LISTALLSTORAGEPOOLS) and not FORCE_OLD_POLL:
+ if backend.support.conn_listallstoragepools() and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name,
backend.listAllStoragePools, build_func)
else:
@@ -136,8 +134,7 @@ def fetch_pools(backend, origmap, build_func):
def fetch_volumes(backend, pool, origmap, build_func):
name = "volume"
- if backend.check_support(
- backend.SUPPORT_POOL_LISTALLVOLUMES, pool) and not FORCE_OLD_POLL:
+ if backend.support.pool_listallvolumes(pool) and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name,
pool.listAllVolumes, build_func)
else:
@@ -153,8 +150,7 @@ def fetch_volumes(backend, pool, origmap, build_func):
def fetch_interfaces(backend, origmap, build_func):
name = "interface"
- if backend.check_support(
- backend.SUPPORT_CONN_LISTALLINTERFACES) and not FORCE_OLD_POLL:
+ if backend.support.conn_listallinterfaces() and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name,
backend.listAllInterfaces, build_func)
else:
@@ -169,8 +165,7 @@ def fetch_interfaces(backend, origmap, build_func):
def fetch_nodedevs(backend, origmap, build_func):
name = "nodedev"
- if backend.check_support(
- backend.SUPPORT_CONN_LISTALLDEVICES) and not FORCE_OLD_POLL:
+ if backend.support.conn_listalldevices() and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name,
backend.listAllDevices, build_func)
else:
@@ -265,8 +260,7 @@ def _old_fetch_vms(backend, origmap, build_func):
def fetch_vms(backend, origmap, build_func):
name = "domain"
- if backend.check_support(
- backend.SUPPORT_CONN_LISTALLDOMAINS):
+ if backend.support.conn_listalldomains():
return _new_poll_helper(origmap, name,
backend.listAllDomains, build_func)
else:
diff --git a/virtinst/storage.py b/virtinst/storage.py
index b63ca31e..2559ab39 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -167,7 +167,7 @@ class StoragePool(_StorageObject):
"""
Helper to build the 'default' storage pool
"""
- if not conn.check_support(conn.SUPPORT_CONN_STORAGE):
+ if not conn.support.conn_storage():
return
pool = None
@@ -212,7 +212,7 @@ class StoragePool(_StorageObject):
"""
path = _get_default_pool_path(conn)
if (not conn.is_remote() and
- not conn.check_support(conn.SUPPORT_CONN_STORAGE)):
+ not conn.support.conn_storage()):
if build and not os.path.exists(path):
os.makedirs(path)
return path
@@ -238,7 +238,7 @@ class StoragePool(_StorageObject):
:returns: virStoragePool object if found, None otherwise
"""
- if not conn.check_support(conn.SUPPORT_CONN_STORAGE):
+ if not conn.support.conn_storage():
return None
for pool in conn.fetch_all_pools():
@@ -719,8 +719,7 @@ class StorageVolume(_StorageObject):
if not self.format and self.file_type == self.TYPE_FILE:
self.format = "raw"
if self._prop_is_unset("lazy_refcounts") and self.format == "qcow2":
- self.lazy_refcounts = self.conn.check_support(
- self.conn.SUPPORT_CONN_QCOW2_LAZY_REFCOUNTS)
+ self.lazy_refcounts = self.conn.support.conn_qcow2_lazy_refcounts()
if self._pool_xml.type == StoragePool.TYPE_LOGICAL:
if self.allocation != self.capacity:
@@ -757,8 +756,7 @@ class StorageVolume(_StorageObject):
if (self.format == "qcow2" and
not self.backing_store and
not self.conn.is_really_test() and
- self.conn.check_support(
- self.conn.SUPPORT_POOL_METADATA_PREALLOC, self.pool)):
+ self.conn.support.pool_metadata_prealloc(self.pool)):
createflags |= libvirt.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
if self.capacity == self.allocation:
# For cloning, this flag will make libvirt+qemu-img preallocate