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