qemu_command: Generate thread-context object for main guest memory

When generating memory for main guest memory memory-backend-*
might be used. This means, we may need to generate thread-context
objects too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2022-11-02 14:07:49 +01:00
parent f808e7c738
commit f1154a4825
2 changed files with 11 additions and 1 deletions

View File

@ -7008,6 +7008,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
g_autoptr(virJSONValue) props = NULL;
g_autoptr(virJSONValue) tcProps = NULL;
virDomainMemoryDef mem = { 0 };
mem.size = virDomainDefGetMemoryInitial(def);
@ -7018,6 +7019,14 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
priv, def, &mem, false, true) < 0)
return -1;
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
return -1;
if (tcProps &&
qemuBuildObjectCommandlineFromJSON(cmd, tcProps,
priv->qemuCaps) < 0)
return -1;
if (qemuBuildObjectCommandlineFromJSON(cmd, props, priv->qemuCaps) < 0)
return -1;

View File

@ -14,7 +14,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-accel tcg \
-cpu qemu64 \
-m 214 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0],"policy":"bind"}' \
-object '{"qom-type":"thread-context","id":"tc-pc.ram","node-affinity":[0]}' \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264,"host-nodes":[0],"policy":"bind","prealloc-context":"tc-pc.ram"}' \
-overcommit mem-lock=off \
-smp 2,sockets=2,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \