[virt-manager PATCH] DomainCpu: check CPU model name only if model exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For CPU modes other then "custom" there is no model so we should not
check the suffix of model name.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 tests/xmlparse.py      | 6 ++++++
 virtinst/domain/cpu.py | 9 +++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index 43acdcd9..2a9dd347 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -342,10 +342,16 @@ class XMLParseTest(unittest.TestCase):
 
         check = self._make_checker(guest.cpu)
         check("mode", "host-passthrough")
+        guest.cpu.check_security_features(guest)
+        check("secure", False)
         guest.cpu.set_special_mode(guest, "host-model")
         check("mode", "host-model")
+        guest.cpu.check_security_features(guest)
+        check("secure", False)
         guest.cpu.set_model(guest, "qemu64")
         check("model", "qemu64")
+        guest.cpu.check_security_features(guest)
+        check("secure", False)
 
         self._alter_compare(guest.get_xml(), outfile)
 
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index fa2df6de..e78d6167 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -135,10 +135,11 @@ class DomainCpu(XMLBuilder):
             return
 
         guestFeatures = [f.name for f in self.features if f.policy == "require"]
-        if self.model.endswith("IBRS"):
-            guestFeatures.append("spec-ctrl")
-        if self.model.endswith("IBPB"):
-            guestFeatures.append("ibpb")
+        if self.model:
+            if self.model.endswith("IBRS"):
+                guestFeatures.append("spec-ctrl")
+            if self.model.endswith("IBPB"):
+                guestFeatures.append("ibpb")
 
         self.secure = set(features) <= set(guestFeatures)
 
-- 
2.20.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux