|
|
e4cbec |
From 8b2f541cb9d2cff02c5bbb7af2de3cb2b0b05d17 Mon Sep 17 00:00:00 2001
|
|
|
e4cbec |
Message-Id: <8b2f541cb9d2cff02c5bbb7af2de3cb2b0b05d17@dist-git>
|
|
|
e4cbec |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
e4cbec |
Date: Wed, 28 Mar 2018 13:45:30 -0600
|
|
|
e4cbec |
Subject: [PATCH] virtinst: compare host and domain cpu models
|
|
|
e4cbec |
|
|
|
e4cbec |
From: Charles Arnold <carnold@suse.com>
|
|
|
e4cbec |
|
|
|
e4cbec |
Lookup the domain capabilities CPU model and compare with
|
|
|
e4cbec |
the host capabilities CPU model and if they are not equal
|
|
|
e4cbec |
set the guest's CPU model to None.
|
|
|
e4cbec |
|
|
|
e4cbec |
(crobinso: compare against 'custom' list not 'host-model', move
|
|
|
e4cbec |
to separate function)
|
|
|
e4cbec |
|
|
|
e4cbec |
(cherry picked from commit fd6a8154408fb462e5437dc920afe4d80da3c1f8)
|
|
|
e4cbec |
|
|
|
e4cbec |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1525337
|
|
|
e4cbec |
|
|
|
e4cbec |
Reviewed-by: Cole Robinson <crobinso@redhat.com>
|
|
|
e4cbec |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
e4cbec |
---
|
|
|
e4cbec |
.../compare/virt-install-boot-uefi.xml | 4 +--
|
|
|
e4cbec |
virtinst/guest.py | 32 ++++++++++++++++---
|
|
|
e4cbec |
2 files changed, 29 insertions(+), 7 deletions(-)
|
|
|
e4cbec |
|
|
|
e4cbec |
diff --git a/tests/cli-test-xml/compare/virt-install-boot-uefi.xml b/tests/cli-test-xml/compare/virt-install-boot-uefi.xml
|
|
|
e4cbec |
index 22f31e6b..f46b8f07 100644
|
|
|
e4cbec |
--- a/tests/cli-test-xml/compare/virt-install-boot-uefi.xml
|
|
|
e4cbec |
+++ b/tests/cli-test-xml/compare/virt-install-boot-uefi.xml
|
|
|
e4cbec |
@@ -15,9 +15,7 @@
|
|
|
e4cbec |
<smm state="on"/>
|
|
|
e4cbec |
<vmport state="off"/>
|
|
|
e4cbec |
</features>
|
|
|
e4cbec |
- <cpu mode="custom" match="exact">
|
|
|
e4cbec |
- <model>Opteron_G4</model>
|
|
|
e4cbec |
- </cpu>
|
|
|
e4cbec |
+ <cpu mode="custom" match="exact"/>
|
|
|
e4cbec |
<clock offset="utc">
|
|
|
e4cbec |
<timer name="rtc" tickpolicy="catchup"/>
|
|
|
e4cbec |
<timer name="pit" tickpolicy="delay"/>
|
|
|
e4cbec |
diff --git a/virtinst/guest.py b/virtinst/guest.py
|
|
|
e4cbec |
index 32acd521..6d4aeb26 100644
|
|
|
e4cbec |
--- a/virtinst/guest.py
|
|
|
e4cbec |
+++ b/virtinst/guest.py
|
|
|
e4cbec |
@@ -880,6 +880,33 @@ class Guest(XMLBuilder):
|
|
|
e4cbec |
else:
|
|
|
e4cbec |
self.emulator = "/usr/lib/xen/bin/qemu-dm"
|
|
|
e4cbec |
|
|
|
e4cbec |
+ def _set_cpu_x86_kvm_default(self):
|
|
|
e4cbec |
+ if self.os.arch != self.conn.caps.host.cpu.arch:
|
|
|
e4cbec |
+ return
|
|
|
e4cbec |
+
|
|
|
e4cbec |
+ self.cpu.set_special_mode(self.x86_cpu_default)
|
|
|
e4cbec |
+ if self.x86_cpu_default != self.cpu.SPECIAL_MODE_HOST_MODEL_ONLY:
|
|
|
e4cbec |
+ return
|
|
|
e4cbec |
+ if not self.cpu.model:
|
|
|
e4cbec |
+ return
|
|
|
e4cbec |
+
|
|
|
e4cbec |
+ # It's possible that the value HOST_MODEL_ONLY gets from
|
|
|
e4cbec |
+ # <capabilities> is not actually supported by qemu/kvm
|
|
|
e4cbec |
+ # combo which will be reported in <domainCapabilities>
|
|
|
e4cbec |
+ domcaps = DomainCapabilities.build_from_guest(self)
|
|
|
e4cbec |
+ domcaps_mode = domcaps.cpu.get_mode("custom")
|
|
|
e4cbec |
+ if not domcaps_mode:
|
|
|
e4cbec |
+ return
|
|
|
e4cbec |
+
|
|
|
e4cbec |
+ cpu_model = domcaps_mode.get_model(self.cpu.model)
|
|
|
e4cbec |
+ if cpu_model and cpu_model.usable:
|
|
|
e4cbec |
+ return
|
|
|
e4cbec |
+
|
|
|
e4cbec |
+ logging.debug("Host capabilities CPU '%s' is not supported "
|
|
|
e4cbec |
+ "according to domain capabilities. Unsettings CPU model",
|
|
|
e4cbec |
+ self.cpu.model)
|
|
|
e4cbec |
+ self.cpu.model = None
|
|
|
e4cbec |
+
|
|
|
e4cbec |
def _set_cpu_defaults(self):
|
|
|
e4cbec |
self.cpu.set_topology_defaults(self.vcpus)
|
|
|
e4cbec |
|
|
|
e4cbec |
@@ -898,14 +925,11 @@ class Guest(XMLBuilder):
|
|
|
e4cbec |
self.cpu.model = "cortex-a57"
|
|
|
e4cbec |
|
|
|
e4cbec |
elif self.os.is_x86() and self.type == "kvm":
|
|
|
e4cbec |
- if self.os.arch != self.conn.caps.host.cpu.arch:
|
|
|
e4cbec |
- return
|
|
|
e4cbec |
+ self._set_cpu_x86_kvm_default()
|
|
|
e4cbec |
|
|
|
e4cbec |
- self.cpu.set_special_mode(self.x86_cpu_default)
|
|
|
e4cbec |
if self._os_object.broken_x2apic():
|
|
|
e4cbec |
self.cpu.add_feature("x2apic", policy="disable")
|
|
|
e4cbec |
|
|
|
e4cbec |
-
|
|
|
e4cbec |
def _hyperv_supported(self):
|
|
|
e4cbec |
if (self.os.loader_type == "pflash" and
|
|
|
e4cbec |
self.os_variant in ("win2k8r2", "win7")):
|
|
|
e4cbec |
--
|
|
|
e4cbec |
2.20.1
|
|
|
e4cbec |
|