[libvirt] [PATCH 1/3] cpu:x86: fix cannot keep cpu feature after migrate/restore

Luyao Huang lhuang at redhat.com
Mon Mar 30 08:49:28 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1207095

When we set feature when cpu model is host-passthrough and start the vm,
we can see these settings in the XML, however after migrate/restore these
flags will be covered by host cpu models.

As cpu model host-passthrough can set feature by users now, so we need
check if there is a feature when do updatecpu().

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 src/cpu/cpu_x86.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index bf1867b..81ab2ca 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2087,8 +2087,7 @@ x86UpdateCustom(virCPUDefPtr guest,
 
 static int
 x86UpdateHostModel(virCPUDefPtr guest,
-                   const virCPUDef *host,
-                   bool passthrough)
+                   const virCPUDef *host)
 {
     virCPUDefPtr oldguest = NULL;
     const struct x86_map *map;
@@ -2118,7 +2117,7 @@ x86UpdateHostModel(virCPUDefPtr guest,
             }
         }
     }
-    for (i = 0; !passthrough && i < oldguest->nfeatures; i++) {
+    for (i = 0; i < oldguest->nfeatures; i++) {
         if (virCPUDefUpdateFeature(guest,
                                    oldguest->features[i].name,
                                    oldguest->features[i].policy) < 0)
@@ -2143,11 +2142,11 @@ x86Update(virCPUDefPtr guest,
 
     case VIR_CPU_MODE_HOST_MODEL:
         guest->match = VIR_CPU_MATCH_EXACT;
-        return x86UpdateHostModel(guest, host, false);
+        return x86UpdateHostModel(guest, host);
 
     case VIR_CPU_MODE_HOST_PASSTHROUGH:
         guest->match = VIR_CPU_MATCH_MINIMUM;
-        return x86UpdateHostModel(guest, host, true);
+        return x86UpdateHostModel(guest, host);
 
     case VIR_CPU_MODE_LAST:
         break;
-- 
1.8.3.1




More information about the libvir-list mailing list