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