Blame SOURCES/libvirt-qemu-Improve-error-when-setting-invalid-count-of-vcpus-via-agent.patch

c401cc
From f63646f85136f711c21dd9d3f867368f87b37edb Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <f63646f85136f711c21dd9d3f867368f87b37edb.1386348947.git.jdenemar@redhat.com>
c401cc
From: Peter Krempa <pkrempa@redhat.com>
c401cc
Date: Fri, 6 Dec 2013 11:29:54 +0100
c401cc
Subject: [PATCH] qemu: Improve error when setting invalid count of vcpus via
c401cc
 agent
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1035108
c401cc
c401cc
When attempting to enable more vCPUs in the guest than is currently
c401cc
enabled in the guest but less than the maximum count for the VM we
c401cc
currently reported an unhelpful message:
c401cc
c401cc
 error: internal error: guest agent reports less cpu than requested
c401cc
c401cc
This patch changes it to:
c401cc
c401cc
 error: invalid argument: requested vcpu count is greater than the count
c401cc
 of enabled vcpus in the domain: 3 > 2
c401cc
c401cc
(cherry picked from commit 34b8449027adc44bd38151f384f5a5cdd64d996f)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/qemu/qemu_driver.c | 8 ++++++++
c401cc
 1 file changed, 8 insertions(+)
c401cc
c401cc
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
c401cc
index 09345b1..4466489 100644
c401cc
--- a/src/qemu/qemu_driver.c
c401cc
+++ b/src/qemu/qemu_driver.c
c401cc
@@ -4265,6 +4265,14 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
c401cc
             goto endjob;
c401cc
         }
c401cc
 
c401cc
+        if (nvcpus > vm->def->vcpus) {
c401cc
+            virReportError(VIR_ERR_INVALID_ARG,
c401cc
+                           _("requested vcpu count is greater than the count "
c401cc
+                             "of enabled vcpus in the domain: %d > %d"),
c401cc
+                           nvcpus, vm->def->vcpus);
c401cc
+            goto endjob;
c401cc
+        }
c401cc
+
c401cc
         qemuDomainObjEnterAgent(vm);
c401cc
         ncpuinfo = qemuAgentGetVCPUs(priv->agent, &cpuinfo);
c401cc
         qemuDomainObjExitAgent(vm);
c401cc
-- 
c401cc
1.8.4.5
c401cc