qemuBuildMemoryBackendProps: Respect //memoryBacking/allocation/@mode=immediate

If user specifies immediate memory allocation in the domain XML,
they want QEMU to fully allocate its memory. And if the memory
was allocated using plain '-m' then we would honour it. But, if a
memory backend is used, then we don't set the prealloc attribute
of the backend.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Michal Privoznik 2020-05-25 14:35:40 +02:00
parent eda5cc7a62
commit 0217c5a6b4
1 changed files with 3 additions and 0 deletions

View File

@ -3028,6 +3028,9 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
if (discard == VIR_TRISTATE_BOOL_ABSENT)
discard = def->mem.discard;
if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
prealloc = true;
if (virDomainNumatuneGetMode(def->numa, mem->targetNode, &mode) < 0 &&
virDomainNumatuneGetMode(def->numa, -1, &mode) < 0)
mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;