* [PATCH for-6.1] qemu-config: restore "machine" in qmp_query_command_line_options()
@ 2021-07-21 15:10 Stefan Hajnoczi
2021-07-21 16:46 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2021-07-21 15:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Stefan Hajnoczi
Commit d8fb7d0969d5c32b3d1b9e20b63ec6c0abe80be4 ("vl: switch -M parsing
to keyval") stopped adding the "machine" QemuOptsList. This causes
"machine" options to not show up in QMP query-command-line-options
output. For example, libvirt cannot detect that kernel_irqchip support
is available.
Adjust the "machine" opts enumeration in
qmp_query_command_line_options() so that options are properly reported.
Fixes: d8fb7d0969d5 ("vl: switch -M parsing to keyval")
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
I'm not familiar with this code. Better solutions welcome!
---
util/qemu-config.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 84ee6dc4ea..52db5e743c 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -255,8 +255,6 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
info->option = g_strdup(vm_config_groups[i]->name);
if (!strcmp("drive", vm_config_groups[i]->name)) {
info->parameters = get_drive_infolist();
- } else if (!strcmp("machine", vm_config_groups[i]->name)) {
- info->parameters = query_option_descs(machine_opts.desc);
} else {
info->parameters =
query_option_descs(vm_config_groups[i]->desc);
@@ -265,6 +263,13 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
}
}
+ if (!has_option || !strcmp(option, "machine")) {
+ info = g_malloc0(sizeof(*info));
+ info->option = g_strdup("machine");
+ info->parameters = query_option_descs(machine_opts.desc);
+ QAPI_LIST_PREPEND(conf_list, info);
+ }
+
if (conf_list == NULL) {
error_setg(errp, "invalid option name: %s", option);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-6.1] qemu-config: restore "machine" in qmp_query_command_line_options()
2021-07-21 15:10 [PATCH for-6.1] qemu-config: restore "machine" in qmp_query_command_line_options() Stefan Hajnoczi
@ 2021-07-21 16:46 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-07-21 16:46 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel
On 21/07/21 17:10, Stefan Hajnoczi wrote:
> Commit d8fb7d0969d5c32b3d1b9e20b63ec6c0abe80be4 ("vl: switch -M parsing
> to keyval") stopped adding the "machine" QemuOptsList. This causes
> "machine" options to not show up in QMP query-command-line-options
> output. For example, libvirt cannot detect that kernel_irqchip support
> is available.
>
> Adjust the "machine" opts enumeration in
> qmp_query_command_line_options() so that options are properly reported.
>
> Fixes: d8fb7d0969d5 ("vl: switch -M parsing to keyval")
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> I'm not familiar with this code. Better solutions welcome!
> ---
> util/qemu-config.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/util/qemu-config.c b/util/qemu-config.c
> index 84ee6dc4ea..52db5e743c 100644
> --- a/util/qemu-config.c
> +++ b/util/qemu-config.c
> @@ -255,8 +255,6 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
> info->option = g_strdup(vm_config_groups[i]->name);
> if (!strcmp("drive", vm_config_groups[i]->name)) {
> info->parameters = get_drive_infolist();
> - } else if (!strcmp("machine", vm_config_groups[i]->name)) {
> - info->parameters = query_option_descs(machine_opts.desc);
> } else {
> info->parameters =
> query_option_descs(vm_config_groups[i]->desc);
> @@ -265,6 +263,13 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
> }
> }
>
> + if (!has_option || !strcmp(option, "machine")) {
> + info = g_malloc0(sizeof(*info));
> + info->option = g_strdup("machine");
> + info->parameters = query_option_descs(machine_opts.desc);
> + QAPI_LIST_PREPEND(conf_list, info);
> + }
> +
> if (conf_list == NULL) {
> error_setg(errp, "invalid option name: %s", option);
> }
>
Given that there's an "if" either way, I guess it's easiest to do it
this way. It may be even be possible (later) to build the info from the
MachineClass properties instead.
Queued, thanks!
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-21 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 15:10 [PATCH for-6.1] qemu-config: restore "machine" in qmp_query_command_line_options() Stefan Hajnoczi
2021-07-21 16:46 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.