]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Improve error when setting invalid count of vcpus via agent
authorPeter Krempa <pkrempa@redhat.com>
Thu, 5 Dec 2013 16:47:14 +0000 (17:47 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 6 Dec 2013 10:09:04 +0000 (11:09 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1035108

When attempting to enable more vCPUs in the guest than is currently
enabled in the guest but less than the maximum count for the VM we
currently reported an unhelpful message:

 error: internal error: guest agent reports less cpu than requested

This patch changes it to:

 error: invalid argument: requested vcpu count is greater than the count
 of enabled vcpus in the domain: 3 > 2

src/qemu/qemu_driver.c

index e2d4e97baed45bb3dbc023d61c694bdbce63355d..66f2a0e651cf3e59f7b0d1075d6def5544521249 100644 (file)
@@ -4201,6 +4201,14 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
             goto endjob;
         }
 
+        if (nvcpus > vm->def->vcpus) {
+            virReportError(VIR_ERR_INVALID_ARG,
+                           _("requested vcpu count is greater than the count "
+                             "of enabled vcpus in the domain: %d > %d"),
+                           nvcpus, vm->def->vcpus);
+            goto endjob;
+        }
+
         qemuDomainObjEnterAgent(vm);
         ncpuinfo = qemuAgentGetVCPUs(priv->agent, &cpuinfo);
         qemuDomainObjExitAgent(vm);