mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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;
|
virDomainNumaCheckABIStability;
|
||||||
virDomainNumaEquals;
|
virDomainNumaEquals;
|
||||||
virDomainNumaFree;
|
virDomainNumaFree;
|
||||||
|
virDomainNumaGetCPUCountTotal;
|
||||||
virDomainNumaGetMaxCPUID;
|
virDomainNumaGetMaxCPUID;
|
||||||
virDomainNumaGetMemorySize;
|
virDomainNumaGetMemorySize;
|
||||||
virDomainNumaGetNodeCount;
|
virDomainNumaGetNodeCount;
|
||||||
|
@ -4903,6 +4903,13 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|||||||
|
|
||||||
if (persistentDef) {
|
if (persistentDef) {
|
||||||
if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
|
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)
|
if (virDomainDefSetVcpusMax(persistentDef, nvcpus) < 0)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user