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

3d61c0
From a1856561962e642553d5ccec89e7ca3f45d18797 Mon Sep 17 00:00:00 2001
3d61c0
Message-Id: <a1856561962e642553d5ccec89e7ca3f45d18797@dist-git>
3d61c0
From: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Date: Thu, 11 Apr 2019 14:57:15 +0200
3d61c0
Subject: [PATCH] domcapabilities: actually fix detection if host-model is safe
3d61c0
 to use
3d61c0
3d61c0
The original code created a new list which had True/False items.  The
3d61c0
only case where the returned value would be False is for empty list
3d61c0
which never happens in real environment.
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
(cherry picked from commit 413858f3dcc6d4c1240dce5593cc876e0c5e216d)
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: Cole Robinson <crobinso@redhat.com>
3d61c0
---
3d61c0
 virtinst/domcapabilities.py | 8 +++++---
3d61c0
 1 file changed, 5 insertions(+), 3 deletions(-)
3d61c0
3d61c0
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
3d61c0
index 822deda8..20b6b38d 100644
3d61c0
--- a/virtinst/domcapabilities.py
3d61c0
+++ b/virtinst/domcapabilities.py
3d61c0
@@ -204,9 +204,11 @@ class DomainCapabilities(XMLBuilder):
3d61c0
         host-model infact predates this support, however it wasn't
3d61c0
         general purpose safe prior to domcaps advertisement.
3d61c0
         """
3d61c0
-        return [(m.name == "host-model" and m.supported and
3d61c0
-                 m.models[0].fallback == "forbid")
3d61c0
-                for m in self.cpu.modes]
3d61c0
+        for m in self.cpu.modes:
3d61c0
+            if (m.name == "host-model" and m.supported and
3d61c0
+                    m.models[0].fallback == "forbid"):
3d61c0
+                return True
3d61c0
+        return False
3d61c0
 
3d61c0
 
3d61c0
     _XML_ROOT_NAME = "domainCapabilities"
3d61c0
-- 
3d61c0
2.20.1
3d61c0