Blame SOURCES/libvirt-Also-filter-out-non-migratable-features-out-of-host-passthrough.patch

898951
From b2c63abced4d6e2f263125ab903917549fcd3abd Mon Sep 17 00:00:00 2001
898951
Message-Id: <b2c63abced4d6e2f263125ab903917549fcd3abd@dist-git>
898951
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
898951
Date: Mon, 29 Sep 2014 12:44:43 +0200
898951
Subject: [PATCH] Also filter out non-migratable features out of
898951
 host-passthrough
898951
898951
Commit de0aeaf filtered them out from the host-model features,
898951
to allow host-model to be migratable by default.
898951
898951
Even though they are not passed to QEMU for host-passthrough,
898951
(and not enabled by default) filter them out too
898951
so the user does not think the domain has them.
898951
898951
https://bugzilla.redhat.com/show_bug.cgi?id=1147584
898951
(cherry picked from commit f53bb1af90737205fdbfd26dc99865c02457d8c9)
898951
https://bugzilla.redhat.com/show_bug.cgi?id=1185458
898951
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
898951
898951
Conflicts:
898951
	src/cpu/cpu_x86.c -- context; const virCPUDefPtr vs. const
898951
        virCPUDef * (changed by d694ae0c)
898951
---
898951
 src/cpu/cpu_x86.c | 14 ++++++--------
898951
 1 file changed, 6 insertions(+), 8 deletions(-)
898951
898951
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
898951
index 341a7f5..dffa488 100644
898951
--- a/src/cpu/cpu_x86.c
898951
+++ b/src/cpu/cpu_x86.c
898951
@@ -1984,7 +1984,8 @@ cleanup:
898951
 
898951
 static int
898951
 x86UpdateHostModel(virCPUDefPtr guest,
898951
-                   const virCPUDefPtr host)
898951
+                   const virCPUDefPtr host,
898951
+                   bool passthrough)
898951
 {
898951
     virCPUDefPtr oldguest = NULL;
898951
     const struct x86_map *map;
898951
@@ -1992,8 +1993,6 @@ x86UpdateHostModel(virCPUDefPtr guest,
898951
     size_t i;
898951
     int ret = -1;
898951
 
898951
-    guest->match = VIR_CPU_MATCH_EXACT;
898951
-
898951
     if (!(map = virCPUx86GetMap()))
898951
         goto cleanup;
898951
 
898951
@@ -2016,8 +2015,7 @@ x86UpdateHostModel(virCPUDefPtr guest,
898951
             }
898951
         }
898951
     }
898951
-
898951
-    for (i = 0; i < oldguest->nfeatures; i++) {
898951
+    for (i = 0; !passthrough && i < oldguest->nfeatures; i++) {
898951
         if (virCPUDefUpdateFeature(guest,
898951
                                    oldguest->features[i].name,
898951
                                    oldguest->features[i].policy) < 0)
898951
@@ -2041,12 +2039,12 @@ x86Update(virCPUDefPtr guest,
898951
         return x86UpdateCustom(guest, host);
898951
 
898951
     case VIR_CPU_MODE_HOST_MODEL:
898951
-        return x86UpdateHostModel(guest, host);
898951
+        guest->match = VIR_CPU_MATCH_EXACT;
898951
+        return x86UpdateHostModel(guest, host, false);
898951
 
898951
     case VIR_CPU_MODE_HOST_PASSTHROUGH:
898951
         guest->match = VIR_CPU_MATCH_MINIMUM;
898951
-        virCPUDefFreeModel(guest);
898951
-        return virCPUDefCopyModel(guest, host, true);
898951
+        return x86UpdateHostModel(guest, host, true);
898951
 
898951
     case VIR_CPU_MODE_LAST:
898951
         break;
898951
-- 
898951
2.2.2
898951