]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBuildMemoryBackendProps: Respect //memoryBacking/allocation/@mode=immediate
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 25 May 2020 12:35:40 +0000 (14:35 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 1 Oct 2020 10:02:19 +0000 (12:02 +0200)
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>
src/qemu/qemu_command.c

index 519a39354103c9ccbfa3772c799f548f26f73337..5c914b3999e96876fe3d6fbc4fc7b3e9f61c243c 100644 (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;