[libvirt] [PATCH] qemu: Improve error when setting invalid count of vcpus via agent

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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e2d4e97..66f2a0e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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); -- 1.8.4.3

On 12/05/2013 09:50 AM, Peter Krempa wrote:
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 | 8 ++++++++ 1 file changed, 8 insertions(+)
ACK -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 12/05/13 20:25, Eric Blake wrote:
On 12/05/2013 09:50 AM, Peter Krempa wrote:
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 | 8 ++++++++ 1 file changed, 8 insertions(+)
ACK
Pushed; Thanks. Peter
participants (2)
-
Eric Blake
-
Peter Krempa