domain.features: use domcapabilities when setting default Hyper-V features

We will no longer enable hyperv features based on libvirt and QEMU
versions.

Some tests don't use the kvm-x86_64-domcaps-latest so the code will now
not enable Hyper-V features. There are still other test cases that cover
Hyper-V features so instead of mangling with URI for these tests update
test data.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2024-06-11 22:46:14 +02:00 committed by Cole Robinson
parent 66bbfa23b2
commit 9e9dbf735c
4 changed files with 17 additions and 40 deletions

View File

@ -15,11 +15,6 @@
</os>
<features>
<pae/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<clock offset="localtime"/>
<pm>
@ -63,11 +58,6 @@
</os>
<features>
<pae/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<clock offset="localtime"/>
<pm>

View File

@ -15,11 +15,6 @@
</os>
<features>
<pae/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<clock offset="localtime"/>
<pm>
@ -73,11 +68,6 @@
</os>
<features>
<pae/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<clock offset="localtime"/>
<pm>

View File

@ -16,11 +16,6 @@
</os>
<features>
<pae/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<cpu>
<topology sockets="1" dies="1" cores="4" threads="1"/>
@ -67,11 +62,6 @@
</os>
<features>
<pae/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<cpu>
<topology sockets="1" dies="1" cores="4" threads="1"/>

View File

@ -63,17 +63,24 @@ class DomainFeatures(XMLBuilder):
if not guest.hyperv_supported():
return
if not self.conn.support.conn_hyperv_vapic():
return
features = guest.lookup_domcaps().supported_hyperv_features()
if self.hyperv_relaxed is None:
self.hyperv_relaxed = True
if self.hyperv_vapic is None:
self.hyperv_vapic = True
if self.hyperv_spinlocks is None:
self.hyperv_spinlocks = True
if self.hyperv_spinlocks_retries is None:
self.hyperv_spinlocks_retries = 8191
def _enable(name, requires=None, feature=None, value=True):
feature = feature or name
if feature not in features:
return
if getattr(self, f"hyperv_{name}") is not None:
return
if requires:
for val in requires:
if getattr(self, f"hyperv_{val}") is not True:
return
setattr(self, f"hyperv_{name}", value)
_enable("relaxed")
_enable("vapic")
_enable("spinlocks")
_enable("spinlocks_retries", feature="spinlocks", value=8191)
def set_defaults(self, guest):
if guest.os.is_container():