[libvirt] [PATCH] qemu: Remove limit enforcing when setting processor count

Peter Krempa pkrempa at redhat.com
Fri Sep 7 12:51:00 UTC 2012


When setting processor count for a domain using the API libvirt enforced
a maximum processor count that was determined using an IOCTL on
/dev/kvm. Unfortunately this value isn't representative enough and qemu
happily accepts and starts with values greater than the reported value.

This patch removes the check so that users are able to use full
potential of their big boxes also when setting processor counts with the
API not just in XML.
---
 src/qemu/qemu_driver.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8e8e00c..6be3e5f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3595,7 +3595,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
     virDomainObjPtr vm;
     virDomainDefPtr persistentDef;
     const char * type;
-    int max;
     int ret = -1;
     bool maximum;

@@ -3645,20 +3644,11 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
         goto endjob;
     }

-    if ((max = qemudGetMaxVCPUs(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.7.12




More information about the libvir-list mailing list