qmp: Expose MachineClass::default_ram_id
cover qmp: Expose MachineClass::default_ram_id
The important patch is 2/2.
Michal Privoznik (2):
qapi: Fix comment format for @CpuInstanceProperties
qmp: Expose MachineClass::default_ram_id
hw/core/machine-qmp-cmds.c | 1 + qapi/machine.json | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 qapi: Fix comment format for @CpuInstanceProperties
In 176d2cda0de, the @die-id attribute was introduced to CpuInstanceProperties type. However, it mangled the comment.
--- qapi/machine.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
qapi/machine.json +2 -1
@@ -824,7 +824,8 @@ # @node-id: NUMA node ID the CPU belongs to # @socket-id: socket number within node/board the CPU belongs to # @die-id: die number within node/board the CPU belongs to (Since 4.1) -# @core-id: core number within die the CPU belongs to# @thread-id: thread number within core the CPU belongs to +# @core-id: core number within die the CPU belongs to +# @thread-id: thread number within core the CPU belongs to # # Note: currently there are 5 properties that could be present # but management should be prepared to pass through other
Signature · 1 line
2.26.2
Re: [PATCH 1/2] qapi: Fix comment format for @CpuInstanceProperties
Quoted 7 lines · Michal Privoznik
In
176d2cda0de, the @die-id attribute was introduced to CpuInstanceProperties type. However, it mangled the comment.Signed-off-by Michal Privoznik <[email protected]>--- qapi/machine.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines
qapi/machine.json +2
-1@@ -824,7 +824,8 @@ # @node-id: NUMA node ID the CPU belongs to # @socket-id: socket number within node/board the CPU belongs to # @die-id: die number within node/board the CPU belongs to (Since 4.1) -# @core-id: core number within die the CPU belongs to# @thread-id: thread number within core the CPU belongs to +# @core-id: core number within die the CPU belongs to +# @thread-id: thread number within core the CPU belongs to # # Note: currently there are 5 properties that could be present # but management should be prepared to pass through other
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
PATCH 2/2 qmp: Expose MachineClass::default_ram_id
In reply to Michal PrivoznikIf a management application (like Libvirt) want's to preserve migration ability and switch to '-machine memory-backend' it needs to set exactly the same RAM id as QEMU would. Since the id is machine type dependant, expose it under 'query-machines' result.
--- hw/core/machine-qmp-cmds.c | 1 + qapi/machine.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
hw/core/machine-qmp-cmds.c +1 -0
@@ -234,6 +234,7 @@ MachineInfoList *qmp_query_machines(Error **errp) info->hotpluggable_cpus = mc->has_hotpluggable_cpus; info->numa_mem_supported = mc->numa_mem_supported; info->deprecated = !!mc->deprecation_reason; + info->default_ram_id =g_strdup (mc->default_ram_id);if (mc->default_cpu_type) { info->default_cpu_type =g_strdup (mc->default_cpu_type); info->has_default_cpu_type = true;
qapi/machine.json +4 -1
@@ -352,6 +352,8 @@ # in future versions of QEMU according to the QEMU deprecation # policy (since 4.1.0) # +# @default-ram-id: the default name of initial RAM memory region (since 5.1) +# # @default-cpu-type: default CPU model typename if none is requested via # the -cpu argument. (since 4.2) #
@@ -361,7 +363,8 @@ 'data': { 'name': 'str', '*alias': 'str', '*is-default': 'bool', 'cpu-max': 'int', 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', - 'deprecated': 'bool', '*default-cpu-type': 'str' } } + 'deprecated': 'bool', 'default-ram-id': 'str', + '*default-cpu-type': 'str' } } ## # @query-machines:
Signature · 1 line
2.26.2
Quoted 7 lines · Michal Privoznik
If a management application (like Libvirt) want's to preserve migration ability and switch to '-machine memory-backend' it needs to set exactly the same RAM id as QEMU would. Since the id is machine type dependant, expose it under 'query-machines' result.
Signed-off-by Michal Privoznik <[email protected]>
The code looks good, but documentation was a bit confusing:
Quoted 1 line
---
[...]
qapi/machine.json line 356
Quoted 2 lines
qapi/machine.json +2
-0+# @default-ram-id: the default name of initial RAM memory region (since 5.1) +#
Everywhere else in the commit message you call it "id", but here you say "name". Also, I don't think we have any references to a "memory region" abstraction in the docs for the QAPI schema, -machine options, or memory backend objects.
I had to look it up in the code, to finally understand you were talking about the memory backend object ID.
To make it consistent with terminology used for -machine and QAPI, I suggest:
@default-ram-id: the default ID of initial RAM memory backend (since 5.1)
I can change it before committing, if you agree.
Quoted 16 lines
# @default-cpu-type: default CPU model typename if none is requested via
# the -cpu argument. (since 4.2)
#qapi/machine.json +2
-1@@ -361,7 +363,8 @@ 'data': { 'name': 'str', '*alias': 'str', '*is-default': 'bool', 'cpu-max': 'int', 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', - 'deprecated': 'bool', '*default-cpu-type': 'str' } } + 'deprecated': 'bool', 'default-ram-id': 'str', + '*default-cpu-type': 'str' } } ## # @query-machines:Signature · 1 line
2.26.2
Signature · 1 line
Eduardo
Quoted 24 lines · Eduardo Habkost
Quoted 7 lines · Michal Privoznik
If a management application (like Libvirt) want's to preserve migration ability and switch to '-machine memory-backend' it needs to set exactly the same RAM id as QEMU would. Since the id is machine type dependant, expose it under 'query-machines' result.
Signed-off-by Michal Privoznik <[email protected]>The code looks good, but documentation was a bit confusing:
Quoted 1 line
---
[...]
qapi/machine.json line 356
Quoted 2 lines
qapi/machine.json +2
-0+# @default-ram-id: the default name of initial RAM memory region (since 5.1) +#Everywhere else in the commit message you call it "id", but here you say "name". Also, I don't think we have any references to a "memory region" abstraction in the docs for the QAPI schema, -machine options, or memory backend objects.
I had to look it up in the code, to finally understand you were talking about the memory backend object ID.
Quoted 6 lines
To make it consistent with terminology used for -machine and QAPI, I suggest:
@default-ram-id: the default ID of initial RAM memory backend (since 5.1)
I can change it before committing, if you agree.
Thanks for the offer, but I will post a v2, because as I was developing patches for libvirt to consume this I found out that some machine types don't have the attribute set (riscv is one of them). Therefore I will have to make this optional.
Michal