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

[libvirt] [PATCH] qemu: match vcpu topology to maximum vcpu numbers.

For qemu, if the -smp N or the value of maxcpus is given, it define
the number of vcpu of guest whenever the vcpu topology is defined or
not. But if the -smp N and maxcpus are missing, the topology can
compute and define vcpus for guest automatically by math:

vcpu number = sockets*cores*threads

For libvirt, as <vcpu> is always mandatory, so we can ask topology
to match maximum vcpu numbers.
 src/conf/domain_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a9656af..ffdc6da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11815,10 +11815,10 @@ virDomainDefParseXML(xmlDocPtr xml,
             goto error;
         if (def->cpu->sockets &&
-            def->maxvcpus >
+            def->maxvcpus !=
             def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
             virReportError(VIR_ERR_XML_DETAIL, "%s",
-                           _("Maximum CPUs greater than topology limit"));
+                           _("Topology limit does not match maximum CPUs"));
             goto error;

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