Blame SOURCES/virt-manager-DomainCpu-check-CPU-model-name-only-if-model-exists.patch

3d61c0
From a16ceb9e3e2e7b34d6759df275839f75e74a539d Mon Sep 17 00:00:00 2001
3d61c0
Message-Id: <a16ceb9e3e2e7b34d6759df275839f75e74a539d@dist-git>
3d61c0
From: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Date: Wed, 10 Apr 2019 20:36:31 +0200
3d61c0
Subject: [PATCH] DomainCpu: check CPU model name only if model exists
3d61c0
3d61c0
For CPU modes other then "custom" there is no model so we should not
3d61c0
check the suffix of model name.
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Reviewed-by: Cole Robinson <crobinso@redhat.com>
3d61c0
(cherry picked from commit c1ebd6730cb25b57124fad6c4030345356703320)
3d61c0
3d61c0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1582667
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Reviewed-by: Cole Robinson <crobinso@redhat.com>
3d61c0
---
3d61c0
 tests/xmlparse.py | 4 ++++
3d61c0
 virtinst/cpu.py   | 9 +++++----
3d61c0
 2 files changed, 9 insertions(+), 4 deletions(-)
3d61c0
3d61c0
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
3d61c0
index a387c026..93379b80 100644
3d61c0
--- a/tests/xmlparse.py
3d61c0
+++ b/tests/xmlparse.py
3d61c0
@@ -326,8 +326,12 @@ class XMLParseTest(unittest.TestCase):
3d61c0
         check = self._make_checker(guest.cpu)
3d61c0
         check("mode", "host-passthrough", "custom")
3d61c0
         check("mode", "custom", "host-model")
3d61c0
+        guest.cpu.check_security_features(guest)
3d61c0
+        check("secure", False)
3d61c0
         guest.cpu.set_model(guest, "qemu64")
3d61c0
         check("model", "qemu64")
3d61c0
+        guest.cpu.check_security_features(guest)
3d61c0
+        check("secure", False)
3d61c0
 
3d61c0
         self._alter_compare(guest.get_xml_config(), outfile)
3d61c0
 
3d61c0
diff --git a/virtinst/cpu.py b/virtinst/cpu.py
3d61c0
index ebe34449..5529196b 100644
3d61c0
--- a/virtinst/cpu.py
3d61c0
+++ b/virtinst/cpu.py
3d61c0
@@ -158,10 +158,11 @@ class CPU(XMLBuilder):
3d61c0
             return
3d61c0
 
3d61c0
         guestFeatures = [f.name for f in self.features if f.policy == "require"]
3d61c0
-        if self.model.endswith("IBRS"):
3d61c0
-            guestFeatures.append("spec-ctrl")
3d61c0
-        if self.model.endswith("IBPB"):
3d61c0
-            guestFeatures.append("ibpb")
3d61c0
+        if self.model:
3d61c0
+            if self.model.endswith("IBRS"):
3d61c0
+                guestFeatures.append("spec-ctrl")
3d61c0
+            if self.model.endswith("IBPB"):
3d61c0
+                guestFeatures.append("ibpb")
3d61c0
 
3d61c0
         self.secure = set(features) <= set(guestFeatures)
3d61c0
 
3d61c0
-- 
3d61c0
2.20.1
3d61c0