connection: Make sure capabilities are refreshed as needed
This commit is contained in:
parent
34c1b5b6d9
commit
306cca9ea0
|
@ -118,6 +118,9 @@ class vmmConnection(gobject.GObject):
|
|||
self.state = self.STATE_DISCONNECTED
|
||||
self.vmm = None
|
||||
|
||||
self._caps = None
|
||||
self._caps_xml = None
|
||||
|
||||
self.network_capable = None
|
||||
self.storage_capable = None
|
||||
self.interface_capable = None
|
||||
|
@ -258,8 +261,22 @@ class vmmConnection(gobject.GObject):
|
|||
def get_uri(self):
|
||||
return self.uri
|
||||
|
||||
def _invalidate_caps(self):
|
||||
self._caps_xml = None
|
||||
self._caps = None
|
||||
|
||||
def _check_caps(self):
|
||||
self._caps_xml = self.vmm.getCapabilities()
|
||||
self._caps = virtinst.CapabilitiesParser.parse(self._caps_xml)
|
||||
|
||||
def get_capabilities(self):
|
||||
return virtinst.CapabilitiesParser.parse(self.vmm.getCapabilities())
|
||||
# Make sure we aren't returning None
|
||||
caps = None
|
||||
while caps == None:
|
||||
self._check_caps()
|
||||
caps = self._caps
|
||||
|
||||
return self._caps
|
||||
|
||||
def get_max_vcpus(self, _type=None):
|
||||
return virtinst.util.get_max_vcpus(self.vmm, _type)
|
||||
|
@ -1334,6 +1351,7 @@ class vmmConnection(gobject.GObject):
|
|||
return
|
||||
|
||||
self.hostinfo = self.vmm.getInfo()
|
||||
self._invalidate_caps()
|
||||
|
||||
# Poll for new virtual network objects
|
||||
(startNets, stopNets, newNets,
|
||||
|
|
Loading…
Reference in New Issue