From: Jiri Denemark Date: Tue, 6 Apr 2010 14:26:36 +0000 (+0200) Subject: Don't ignore guest CPU selection when unsupported by HV X-Git-Tag: v0.8.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f599156641d00a3d360c3f60252ddafe7a665c8f;p=thirdparty%2Flibvirt.git Don't ignore guest CPU selection when unsupported by HV When qemu libvirt driver doesn't support guest CPU selection with given qemu binary, guests requiring specific CPU should fail to start instead of being silently supplied with a default CPU. --- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 538784a83d..f56a7ef55c 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -3249,9 +3249,16 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, virBuffer buf = VIR_BUFFER_INITIALIZER; int i; - if (def->cpu && def->cpu->model - && qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0) - goto cleanup; + if (def->cpu && def->cpu->model) { + if (qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0) + goto cleanup; + + if (!ncpus || !host) { + qemuReportError(VIR_ERR_NO_SUPPORT, "%s", + _("CPU specification not supported by hypervisor")); + goto cleanup; + } + } if (ncpus > 0 && host) { virCPUCompareResult cmp;