]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: process: Disallow VMs with 0 vcpus
authorPeter Krempa <pkrempa@redhat.com>
Wed, 6 Jan 2016 15:27:45 +0000 (16:27 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Jan 2016 16:45:09 +0000 (17:45 +0100)
Counterintuitively the user would end up with a VM with maximum number
of vCPUs available.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1290324

src/qemu/qemu_process.c

index 506979771fc396f0d1de6b854830a1e880b6dcbf..97af3fa99fa21faf60a137f6c71d753f99b75184 100644 (file)
@@ -3897,6 +3897,12 @@ qemuValidateCpuCount(virDomainDefPtr def,
 {
     unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->os.machine);
 
+    if (virDomainDefGetVcpus(def) == 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Domain requires at least 1 vCPU"));
+        return -1;
+    }
+
     if (maxCpus > 0 && virDomainDefGetVcpusMax(def) > maxCpus) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Maximum CPUs greater than specified machine type limit"));