[libvirt] [RFC PATCH] Behaviour of topology, vcpus and maxcpus

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

Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> writes:
I have observed the following with libvirt xml:
<vcpu>6</vcpu> <cpu> <topology sockets='1' cores='4' threads='2'/> </cpu>
So according to the topology maximum supported is 8 vcpus, while the libvirt sets that to 6 - specified in <vcpu> tag. Shouldn't libvirt error this out as the mismatch between the topology definition and the vcpu count?
There is an upper bound check already in place where if we have maxcpu > topology-supported cpus, that errors out. For eg.
<vcpu>12</vcpu> <cpu> <topology sockets='1' cores='4' threads='2'/> </cpu>
The below patch make sures that libvirt does the lower bound check as well.
Ping, Any comments? Regards Nikunj
participants (1)
-
Nikunj A Dadhania