提交 b527e7c8 编写于 作者: P Peter Krempa

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
上级 63e2b766
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册