Blame SOURCES/virt-manager-domcapabilities-fix-detection-if-host-model-is-safe-to-use.patch

3d61c0
From a08b594291c9c62a84ad5b820b77b7aff9079cb1 Mon Sep 17 00:00:00 2001
3d61c0
Message-Id: <a08b594291c9c62a84ad5b820b77b7aff9079cb1@dist-git>
3d61c0
From: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Date: Wed, 13 Mar 2019 14:18:14 +0100
3d61c0
Subject: [PATCH] domcapabilities: fix detection if host-model is safe to use
3d61c0
3d61c0
According to libvirt documentation for host-model [1] it is safe to use
3d61c0
it only if 'fallback' attribute is set to 'forbid', this indicates that
3d61c0
the libvirt and QEMU are new enough and can safely filter list of cpu
3d61c0
features that will be guaranteed to be visible inside of the guest.
3d61c0
3d61c0
[1] <https://libvirt.org/formatdomain.html#elementsCPU>
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Reviewed-by: Cole Robinson <crobinso@redhat.com>
3d61c0
(cherry picked from commit 9fdbbca27fa820d58b1bff58d215e6847b848f0a)
3d61c0
3d61c0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1525337
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3d61c0
---
3d61c0
 virtinst/domcapabilities.py | 5 +++--
3d61c0
 1 file changed, 3 insertions(+), 2 deletions(-)
3d61c0
3d61c0
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
3d61c0
index ddc8b17c..822deda8 100644
3d61c0
--- a/virtinst/domcapabilities.py
3d61c0
+++ b/virtinst/domcapabilities.py
3d61c0
@@ -202,9 +202,10 @@ class DomainCapabilities(XMLBuilder):
3d61c0
         """
3d61c0
         Return True if domcaps reports support for cpu mode=host-model.
3d61c0
         host-model infact predates this support, however it wasn't
3d61c0
-        general purpose safe prior to domcaps advertisement
3d61c0
+        general purpose safe prior to domcaps advertisement.
3d61c0
         """
3d61c0
-        return [(m.name == "host-model" and m.supported)
3d61c0
+        return [(m.name == "host-model" and m.supported and
3d61c0
+                 m.models[0].fallback == "forbid")
3d61c0
                 for m in self.cpu.modes]
3d61c0
 
3d61c0
 
3d61c0
-- 
3d61c0
2.20.1
3d61c0