[libvirt] [PATCH] qemu: Remove maximum cpu limit when setting processor count using the API

Peter Krempa pkrempa at redhat.com
Thu Apr 4 22:11:31 UTC 2013


When setting processor count for a domain using the API libvirt enforced
a maximum processor count, while it isn't enforced when taking the XML path.

This patch removes the check to match the API.
---
 src/qemu/qemu_driver.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3f62414..833bf7f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3737,8 +3737,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
     virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm = NULL;
     virDomainDefPtr persistentDef;
-    const char * type;
-    int max;
     int ret = -1;
     bool maximum;
     virQEMUDriverConfigPtr cfg = NULL;
@@ -3778,27 +3776,11 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
         goto endjob;
     }

-    if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unknown virt type in domain definition '%d'"),
-                       vm->def->virtType);
-        goto endjob;
-    }
-
-    if ((max = qemuGetMaxVCPUs(NULL, type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not determine max vcpus for the domain"));
-        goto endjob;
-    }
-
-    if (!maximum && vm->def->maxvcpus < max) {
-        max = vm->def->maxvcpus;
-    }
-
-    if (nvcpus > max) {
+    if (!maximum && nvcpus > vm->def->maxvcpus) {
         virReportError(VIR_ERR_INVALID_ARG,
                        _("requested vcpus is greater than max allowable"
-                         " vcpus for the domain: %d > %d"), nvcpus, max);
+                         " vcpus for the domain: %d > %d"),
+                       nvcpus, vm->def->maxvcpus);
         goto endjob;
     }

-- 
1.8.1.5




More information about the libvir-list mailing list