]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_process: skip only cpu features
authorPavel Hrdina <phrdina@redhat.com>
Tue, 29 Mar 2016 13:13:52 +0000 (15:13 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 30 Mar 2016 08:35:15 +0000 (10:35 +0200)
This check is there to allow restore saved domain with older libvirt
where we included invtsc by default for host-passthrough model.  Don't
skip the whole function, but only the part that checks for invtsc.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_process.c

index 205d9ae41c93f8bae9af2c4314e717574bdf8e51..9334a753b35bfae28b9832ab179867bf8291b799 100644 (file)
@@ -3904,11 +3904,6 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
     bool ret = false;
     size_t i;
 
-    /* no features are passed to QEMU with -cpu host
-     * so it makes no sense to verify them */
-    if (def->cpu && def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
-        return true;
-
     switch (arch) {
     case VIR_ARCH_I686:
     case VIR_ARCH_X86_64:
@@ -3933,17 +3928,20 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
             }
         }
 
-        for (i = 0; def->cpu && i < def->cpu->nfeatures; i++) {
-            virCPUFeatureDefPtr feature = &def->cpu->features[i];
 
-            if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
-                continue;
+        if (def->cpu && def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
+            for (i = 0; i < def->cpu->nfeatures; i++) {
+                virCPUFeatureDefPtr feature = &def->cpu->features[i];
 
-            if (STREQ(feature->name, "invtsc") &&
-                !cpuHasFeature(guestcpu, feature->name)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("host doesn't support invariant TSC"));
-                goto cleanup;
+                if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+                    continue;
+
+                if (STREQ(feature->name, "invtsc") &&
+                    !cpuHasFeature(guestcpu, feature->name)) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("host doesn't support invariant TSC"));
+                    goto cleanup;
+                }
             }
         }
         break;