qemu_validate: Validate prealloc threads against qemuCpas

Only fairly new QEMUs are capable of user provided number of
preallocation threads. Validate this assumption.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2022-03-21 17:09:40 +01:00
parent a30dac15dc
commit 75a4e0165e

View File

@ -739,6 +739,13 @@ qemuValidateDomainDefMemory(const virDomainDef *def,
return -1;
}
if (mem->allocation_threads > 0 &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("preallocation threads are unsupported with this QEMU"));
return -1;
}
if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("hugepages are not allowed with anonymous "