[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 1/1] Added check for maximum number of vcpus exceeding topology limit

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
 - Added check for topology specification

 src/conf/domain_conf.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 180dd2b..5e36270 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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"

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]