[libvirt] [PATCH 2/3] qemu_process: skip only cpu features

Pavel Hrdina phrdina at redhat.com
Tue Mar 29 13:31:17 UTC 2016


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 at redhat.com>
---
 src/qemu/qemu_process.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 205d9ae..9334a75 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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;
-- 
2.7.4




More information about the libvir-list mailing list