mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Error out if setting vcpu count would lead to invalid config
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
This commit is contained in:
parent
63e2b766a5
commit
b527e7c8e2
@ -674,6 +674,7 @@ virNodeDeviceObjUnlock;
|
||||
virDomainNumaCheckABIStability;
|
||||
virDomainNumaEquals;
|
||||
virDomainNumaFree;
|
||||
virDomainNumaGetCPUCountTotal;
|
||||
virDomainNumaGetMaxCPUID;
|
||||
virDomainNumaGetMemorySize;
|
||||
virDomainNumaGetNodeCount;
|
||||
|
@ -4903,6 +4903,13 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user