qemu_command: Generate -mem-prealloc in one corner case more

When guest has NUMA nodes and QEMU is new enough to report
default RAM ID then ideally we would use -numa memdev= combined
with memory-backend-* combo becasue -mem-path/-mem-prealloc/-numa
mem are deprecated. Well, there is one problem - the .memdev=
attribute is machine type dependent (just look at arguments of
virQEMUCapsGetMachineNumaMemSupported()) and to ensure backwards
compatibility we prefer -numa mem= over -numa memdev=.

But there was one corner case when -mem-prealloc was requested
but not generated on the cmd line. It all starts with
qemuBuildMemCommandLine() which generates just '-m XXX' and
because it sees defaultRAMid and guest NUMA nodes greater than
zero it does nothing more.

Then, qemuBuildNumaCommandLine() sees that -numa mem= is still
supported for given machine type and nothing else set
@needBackend thus qemuBuildMemPathStr() is called which output
-mem-prealloc only in a few cases assuming it was outputted
earlier.

Reported-by: Jing Qi <jinqi@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik
2021-09-15 15:59:59 +02:00
parent 3f390db2e2
commit 3010a69226
5 changed files with 15 additions and 18 deletions

View File

@@ -15,6 +15,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-pc/.config \
-m 1024 \
-overcommit mem-lock=off \
-smp 2,sockets=2,cores=1,threads=1 \
-mem-prealloc \
-numa node,nodeid=0,cpus=0-1,mem=1024 \
-uuid bb508b28-d57b-44bd-9e9c-a134cef24b60 \
-display none \