When the domain definition describes a machine with NUMA, setting the
maximum vCPU count via the API might lead to an invalid config.
Add a check that will forbid this until we add more advanced cpu config
capabilities.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1327499
virDomainNumaCheckABIStability;
virDomainNumaEquals;
virDomainNumaFree;
+virDomainNumaGetCPUCountTotal;
virDomainNumaGetMaxCPUID;
virDomainNumaGetMemorySize;
virDomainNumaGetNodeCount;
if (persistentDef) {
if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
+ if (virDomainNumaGetCPUCountTotal(persistentDef->numa) > nvcpus) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Number of CPUs in <numa> exceeds the desired "
+ "maximum vcpu count"));
+ goto endjob;
+ }
+
if (virDomainDefSetVcpusMax(persistentDef, nvcpus) < 0)
goto endjob;
} else {