mirror of
https://github.com/libvirt/libvirt.git
synced 2025-01-08 07:03:19 -06:00
qemu: driver: Validate configuration when setting maximum vcpu count
Setting vcpu count when cpu topology is specified may result into an invalid configuration. Since the topology can't be modified, reject the setting if it doesn't match the requested topology. This will allow fixing the topology in case it was broken. Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1370066
This commit is contained in:
parent
c9cb35c255
commit
802fac97ec
@ -4730,6 +4730,18 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (persistentDef && persistentDef->cpu && persistentDef->cpu->sockets) {
|
||||
/* allow setting a valid vcpu count for the topology so an invalid
|
||||
* setting may be corrected via this API */
|
||||
if (nvcpus != persistentDef->cpu->sockets *
|
||||
persistentDef->cpu->cores *
|
||||
persistentDef->cpu->threads) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("CPU topology doesn't match the desired vcpu count"));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user