virt-install: use default --cpu mode more often

Currently we will only apply the default `--cpu mode=host-passthrough`
config when _no_ `--cpu` config is passed. But this means if a user
configures ex. cpu `<topology>`, we don't set `host-passthrough` and
they get the libvirt/qemu default baseline CPU.

Instead, only skip the default config if the user manually
specified a `mode` or `model` value directly

https://issues.redhat.com/browse/RHEL-65371

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-11-16 14:16:44 -05:00 committed by Pavel Hrdina
parent 8fb78739e7
commit f3aa24bd5d
2 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@
<apic/>
<vmport state="off"/>
</features>
<cpu>
<cpu mode="host-passthrough">
<numa>
<cell cpus="0" memory="1048576"/>
</numa>
@ -162,7 +162,7 @@
<apic/>
<vmport state="off"/>
</features>
<cpu>
<cpu mode="host-passthrough">
<numa>
<cell cpus="0" memory="1048576"/>
</numa>

View File

@ -450,9 +450,9 @@ class DomainCpu(XMLBuilder):
def set_defaults(self, guest):
if not self.conn.is_test() and not self.conn.is_qemu():
return
if (self.get_xml().strip() or
self.special_mode_was_set):
# User already configured CPU
if self.special_mode_was_set:
return
if self.model or self.mode:
return
if guest.os.is_arm_machvirt() and guest.type == "kvm":