connection: rename fetch_all_guests->fetch_all_domains

The virtinst class is erroneously called Guest, but these
functions are dealing with libvirt <domain> XML, so rename them
This commit is contained in:
Cole Robinson 2018-08-31 15:20:50 -04:00
parent 83a9e613e9
commit 2b41e130d8
5 changed files with 13 additions and 13 deletions

View File

@ -107,7 +107,7 @@ class _URIs(object):
return conn
if uri not in self._conn_cache:
conn.fetch_all_guests()
conn.fetch_all_domains()
conn.fetch_all_pools()
conn.fetch_all_vols()
conn.fetch_all_nodedevs()

View File

@ -273,7 +273,7 @@ class vmmConnection(vmmGObject):
time.sleep(.1)
def _init_virtconn(self):
self._backend.cb_fetch_all_guests = (
self._backend.cb_fetch_all_domains = (
lambda: [obj.get_xmlobj(refresh_if_nec=False)
for obj in self.list_vms()])
self._backend.cb_fetch_all_pools = (
@ -997,7 +997,7 @@ class vmmConnection(vmmGObject):
self.close()
self._objects = None
self._backend.cb_fetch_all_guests = None
self._backend.cb_fetch_all_domains = None
self._backend.cb_fetch_all_pools = None
self._backend.cb_fetch_all_nodedevs = None
self._backend.cb_fetch_all_vols = None

View File

@ -64,7 +64,7 @@ class VirtinstConnection(object):
# These let virt-manager register a callback which provides its
# own cached object lists, rather than doing fresh calls
self.cb_fetch_all_guests = None
self.cb_fetch_all_domains = None
self.cb_fetch_all_pools = None
self.cb_fetch_all_vols = None
self.cb_fetch_all_nodedevs = None
@ -156,27 +156,27 @@ class VirtinstConnection(object):
# Polling routines #
####################
_FETCH_KEY_GUESTS = "vms"
_FETCH_KEY_DOMAINS = "vms"
_FETCH_KEY_POOLS = "pools"
_FETCH_KEY_VOLS = "vols"
_FETCH_KEY_NODEDEVS = "nodedevs"
def _fetch_all_guests_raw(self):
def _fetch_all_domains_raw(self):
ignore, ignore, ret = pollhelpers.fetch_vms(
self, {}, lambda obj, ignore: obj)
return [Guest(weakref.ref(self), parsexml=obj.XMLDesc(0))
for obj in ret]
def fetch_all_guests(self):
def fetch_all_domains(self):
"""
Returns a list of Guest() objects
"""
if self.cb_fetch_all_guests:
return self.cb_fetch_all_guests() # pylint: disable=not-callable
if self.cb_fetch_all_domains:
return self.cb_fetch_all_domains() # pylint: disable=not-callable
key = self._FETCH_KEY_GUESTS
key = self._FETCH_KEY_DOMAINS
if key not in self._fetch_cache:
self._fetch_cache[key] = self._fetch_all_guests_raw()
self._fetch_cache[key] = self._fetch_all_domains_raw()
return self._fetch_cache[key][:]
def _build_pool_raw(self, poolobj):

View File

@ -344,7 +344,7 @@ class DeviceDisk(Device):
vols.append(backpath)
ret = []
vms = conn.fetch_all_guests()
vms = conn.fetch_all_domains()
for vm in vms:
if not read_only:
if path in [vm.os.kernel, vm.os.initrd, vm.os.dtb]:

View File

@ -172,7 +172,7 @@ class DeviceInterface(Device):
if searchmac is None:
return (False, None)
vms = conn.fetch_all_guests()
vms = conn.fetch_all_domains()
for vm in vms:
for nic in vm.devices.interface:
nicmac = nic.macaddr or ""