From e7cc2e3befad24471e070d39cf6f90cc9f7aaf32 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 29 Mar 2016 15:13:52 +0200 Subject: [PATCH] qemu_process: skip only cpu features 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 --- 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 205d9ae41c..9334a753b3 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;