From f3aa24bd5d9adb077f9d093b5a8d42f403d6eed8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 16 Nov 2024 14:16:44 -0500 Subject: [PATCH] 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 ``, 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 --- tests/data/cli/compare/virt-install-memory-hotplug.xml | 4 ++-- virtinst/domain/cpu.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/data/cli/compare/virt-install-memory-hotplug.xml b/tests/data/cli/compare/virt-install-memory-hotplug.xml index 31e06c7c9..61e39ee02 100644 --- a/tests/data/cli/compare/virt-install-memory-hotplug.xml +++ b/tests/data/cli/compare/virt-install-memory-hotplug.xml @@ -18,7 +18,7 @@ - + @@ -162,7 +162,7 @@ - + diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py index c635932ed..df0ca2250 100644 --- a/virtinst/domain/cpu.py +++ b/virtinst/domain/cpu.py @@ -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":