<div dir="ltr"><div>I have observed the following with libvirt xml:</div><div><br></div><div><vcpu>6</vcpu></div><div><cpu></div><div>  <topology sockets='1' cores='4' threads='2'/></div>
<div></cpu></div><div><br></div><div>So according to the topology maximum supported is 8 vcpus, while the</div><div>libvirt sets that to 6 - specified in <vcpu> tag. Shouldn't libvirt</div><div>error this out as the mismatch between the topology definition and the</div>
<div>vcpu count?</div><div><br></div><div>There is an upper bound check already in place where if we have maxcpu ></div><div>topology-supported cpus, that errors out. For eg.</div><div><br></div><div><vcpu>12</vcpu></div>
<div><cpu></div><div>  <topology sockets='1' cores='4' threads='2'/></div><div></cpu></div><div><br></div><div>The below patch make sures that libvirt does the lower bound check as</div>
<div>well.</div><div><br></div><div>Regards</div><div>Nikunj</div><div><br></div><div><br></div><div>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c</div><div>index f96110b..aa25940 100644</div><div>[ 0001-Behaviour-of-topology-vcpus-and-maxcpus.patch: inline patch (as text/x-diff) ]</div>
<div>--- a/src/conf/domain_conf.c</div><div>+++ b/src/conf/domain_conf.c</div><div>@@ -12933,6 +12933,14 @@ virDomainDefParseXML(xmlDocPtr xml,</div><div><span class="" style="white-space:pre">   </span>     goto error;</div>
<div><span class="" style="white-space:pre">    </span> }</div><div><br></div><div>+        if (def->cpu->sockets &&</div><div>+            def->maxvcpus <</div><div>+            def->cpu->sockets * def->cpu->cores * def->cpu->threads) {</div>
<div>+            virReportError(VIR_ERR_XML_DETAIL, "%s",</div><div>+                           _("CPUs provided is less than topology"));</div><div>+            goto error;</div><div>+        }</div>
<div>+</div><div><span class="" style="white-space:pre">    </span> if (def->cpu->cells_cpus > def->maxvcpus) {</div><div><span class="" style="white-space:pre">   </span>     virReportError(VIR_ERR_INTERNAL_ERROR, "%s",</div>
<div><span class="" style="white-space:pre">                    </span>    _("Number of CPUs in <numa> exceeds the"</div><div><br></div></div>