]> xenbits.xensource.com Git - libvirt.git/commitdiff
Added check for maximum number of vcpus exceeding topology limit
authorMartin Kletzander <mkletzan@redhat.com>
Thu, 12 Jan 2012 10:11:33 +0000 (11:11 +0100)
committerEric Blake <eblake@redhat.com>
Thu, 12 Jan 2012 23:02:08 +0000 (16:02 -0700)
Earlier, when the number of vcpus was greater than the topology allowed,
libvirt didn't raise an error and continued, resulting in running qemu
with parameters making no sense. Even though qemu did not report any
error itself, the number of vcpus was set to maximum allowed by the
topology.

AUTHORS
src/conf/domain_conf.c

diff --git a/AUTHORS b/AUTHORS
index b681424bcbc9cb42e66f76703cd3527b24451004..74f31577462310aad1aa1d5255f011216751da05 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -215,6 +215,7 @@ Patches have also been contributed by:
   Rommer               <rommer@active.by>
   Yuri Chornoivan      <yurchor@ukr.net>
   Deepak C Shetty      <deepakcs@linux.vnet.ibm.com>
+  Martin Kletzander    <mkletzan@redhat.com>
 
   [....send patches to get your name here....]
 
index 180dd2bf9d7c6b674803d18e4dec0ec91ff0187c..5e36270613b2fe1ff629cada2f9f4bca97578c1b 100644 (file)
@@ -8010,6 +8010,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         if (def->cpu == NULL)
             goto error;
 
+        if (def->cpu->sockets &&
+            def->maxvcpus >
+            def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
+            virDomainReportError(VIR_ERR_XML_DETAIL, "%s",
+                                 _("Maximum CPUs greater than topology limit"));
+            goto error;
+        }
+
         if (def->cpu->cells_cpus > def->maxvcpus) {
             virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                  _("Number of CPUs in <numa> exceeds the"