details: Use Guest.lookup_domcaps helper

This ensures the Guest object domcaps cache is primed as well, which
prevents the CPU security features handling from constantly refetching
domcaps info.

We need to tweak the cache invalidation check in Guest to handle
some of the test suite hackery we do

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-11-12 14:11:53 -05:00
parent 5d91237386
commit fb2bfd610f
2 changed files with 5 additions and 3 deletions

View File

@ -12,7 +12,6 @@ import libvirt
from virtinst import DeviceController
from virtinst import DeviceDisk
from virtinst import DomainCapabilities
from virtinst import DomainSnapshot
from virtinst import Guest
from virtinst import log
@ -311,8 +310,7 @@ class vmmDomain(vmmLibvirtObject):
def get_domain_capabilities(self):
if not self._domain_caps:
self._domain_caps = DomainCapabilities.build_from_guest(
self.get_xmlobj())
self._domain_caps = self.get_xmlobj().lookup_domcaps()
return self._domain_caps

View File

@ -641,6 +641,10 @@ class Guest(XMLBuilder):
def lookup_domcaps(self):
# We need to regenerate domcaps cache if any of these values change
def _compare(domcaps):
if self.type == "test":
# Test driver doesn't support domcaps. We kinda fake it in
# some cases, but it screws up the checking here for parsed XML
return True
if self.os.machine and self.os.machine != domcaps.machine:
return False
if self.type and self.type != domcaps.domain: