]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't ignore guest CPU selection when unsupported by HV
authorJiri Denemark <jdenemar@redhat.com>
Tue, 6 Apr 2010 14:26:36 +0000 (16:26 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 7 Apr 2010 19:32:46 +0000 (21:32 +0200)
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.

src/qemu/qemu_conf.c

index 538784a83d39e93967f9bdd4dfe468cad6ed5b05..f56a7ef55cab63c52136db5545bbd0ce8039adb2 100644 (file)
@@ -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;