* Re: [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options
2015-04-01 16:47 [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options Marcel Apfelbaum
@ 2015-04-01 17:27 ` Marcel Apfelbaum
2015-04-01 17:29 ` Eric Blake
2015-04-02 12:38 ` Paolo Bonzini
2 siblings, 0 replies; 6+ messages in thread
From: Marcel Apfelbaum @ 2015-04-01 17:27 UTC (permalink / raw)
To: Marcel Apfelbaum, qemu-devel; +Cc: pbonzini, akrowiak, armbru
On 04/01/2015 07:47 PM, Marcel Apfelbaum wrote:
> Commit 49d2e64 (machine: remove qemu_machine_opts global list)
> made machine options specific to machine sub-type, leaving
> the qemu_machine_opts desc array empty. Sadly this is the place
> qmp_query_command_line_options is looking for supported options.
>
> As a fix for for 2.3 the machine_qemu_opts (the generic ones)
> are restored only for qemu-config scope.
> We need to find a better fix for 2.4.
>
> Reported-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Added Eric Blake to CC list.
> ---
> v1->v2:
> Addressed Eric Blake's and Markus Armbruster's comments:
> - Left only generic options (and not the per-machine options) in machine_qemu_opts.
> - Corrected some spelling errors.
>
> util/qemu-config.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 81 insertions(+)
>
> diff --git a/util/qemu-config.c b/util/qemu-config.c
> index f3463df..2d32ce7 100644
> --- a/util/qemu-config.c
> +++ b/util/qemu-config.c
> @@ -6,6 +6,7 @@
> #include "hw/qdev.h"
> #include "qapi/error.h"
> #include "qmp-commands.h"
> +#include "hw/i386/pc.h"
>
> static QemuOptsList *vm_config_groups[32];
> static QemuOptsList *drive_config_groups[4];
> @@ -148,6 +149,84 @@ static CommandLineParameterInfoList *get_drive_infolist(void)
> return head;
> }
>
> +/* restore machine options that are now machine's properties */
> +static QemuOptsList machine_opts = {
> + .merge_lists = true,
> + .head = QTAILQ_HEAD_INITIALIZER(machine_opts.head),
> + .desc = {
> + {
> + .name = "type",
> + .type = QEMU_OPT_STRING,
> + .help = "emulated machine"
> + },{
> + .name = "accel",
> + .type = QEMU_OPT_STRING,
> + .help = "accelerator list",
> + },{
> + .name = "kernel_irqchip",
> + .type = QEMU_OPT_BOOL,
> + .help = "use KVM in-kernel irqchip",
> + },{
> + .name = "kvm_shadow_mem",
> + .type = QEMU_OPT_SIZE,
> + .help = "KVM shadow MMU size",
> + },{
> + .name = "kernel",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux kernel image file",
> + },{
> + .name = "initrd",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux initial ramdisk file",
> + },{
> + .name = "append",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux kernel command line",
> + },{
> + .name = "dtb",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux kernel device tree file",
> + },{
> + .name = "dumpdtb",
> + .type = QEMU_OPT_STRING,
> + .help = "Dump current dtb to a file and quit",
> + },{
> + .name = "phandle_start",
> + .type = QEMU_OPT_NUMBER,
> + .help = "The first phandle ID we may generate dynamically",
> + },{
> + .name = "dt_compatible",
> + .type = QEMU_OPT_STRING,
> + .help = "Overrides the \"compatible\" property of the dt root node",
> + },{
> + .name = "dump-guest-core",
> + .type = QEMU_OPT_BOOL,
> + .help = "Include guest memory in a core dump",
> + },{
> + .name = "mem-merge",
> + .type = QEMU_OPT_BOOL,
> + .help = "enable/disable memory merge support",
> + },{
> + .name = "usb",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on/off to enable/disable usb",
> + },{
> + .name = "firmware",
> + .type = QEMU_OPT_STRING,
> + .help = "firmware image",
> + },{
> + .name = "iommu",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> + },{
> + .name = "suppress-vmdesc",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on to disable self-describing migration",
> + },
> + { /* End of list */ }
> + }
> +};
> +
> CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
> const char *option,
> Error **errp)
> @@ -162,6 +241,8 @@ 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);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options
2015-04-01 16:47 [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options Marcel Apfelbaum
2015-04-01 17:27 ` Marcel Apfelbaum
@ 2015-04-01 17:29 ` Eric Blake
2015-04-01 17:36 ` Marcel Apfelbaum
2015-04-02 12:38 ` Paolo Bonzini
2 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2015-04-01 17:29 UTC (permalink / raw)
To: Marcel Apfelbaum, qemu-devel; +Cc: pbonzini, akrowiak, armbru
[-- Attachment #1: Type: text/plain, Size: 2250 bytes --]
On 04/01/2015 10:47 AM, Marcel Apfelbaum wrote:
> Commit 49d2e64 (machine: remove qemu_machine_opts global list)
> made machine options specific to machine sub-type, leaving
> the qemu_machine_opts desc array empty. Sadly this is the place
> qmp_query_command_line_options is looking for supported options.
>
> As a fix for for 2.3 the machine_qemu_opts (the generic ones)
> are restored only for qemu-config scope.
> We need to find a better fix for 2.4.
>
> Reported-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> + },{
> + .name = "firmware",
> + .type = QEMU_OPT_STRING,
> + .help = "firmware image",
> + },{
> + .name = "iommu",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> + },{
> + .name = "suppress-vmdesc",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on to disable self-describing migration",
> + },
No longer a strict superset of the Fedora 21 qemu-kvm, which had:
"parameters": [
{
"name": "max-ram-below-4g",
"help": "maximum ram below the 4G boundary (32bit
boundary)"
,
"type": "size"
},
{
"name": "kvm-type",
"help": "Specifies the KVM virtualization mode (HV,
PR)",
"type": "string"
},
{
"name": "firmware",
"help": "firmware image",
"type": "string"
},
(remembering that query-command-line-options does things in reverse
order). I don't think iommu and suppress-vmdesc hurt to add, but we
shouldn't lose kvm-type or max-ram-below-4g, if those were advertised at
the point prior to the QemuOpts conversion. (I didn't actually
research, though, whether I'm comparing against downstream Fedora
qemu-kvm patches instead of upstream...)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options
2015-04-01 17:29 ` Eric Blake
@ 2015-04-01 17:36 ` Marcel Apfelbaum
2015-04-01 18:20 ` Eric Blake
0 siblings, 1 reply; 6+ messages in thread
From: Marcel Apfelbaum @ 2015-04-01 17:36 UTC (permalink / raw)
To: Eric Blake, qemu-devel; +Cc: pbonzini, akrowiak, armbru
On 04/01/2015 08:29 PM, Eric Blake wrote:
> On 04/01/2015 10:47 AM, Marcel Apfelbaum wrote:
>> Commit 49d2e64 (machine: remove qemu_machine_opts global list)
>> made machine options specific to machine sub-type, leaving
>> the qemu_machine_opts desc array empty. Sadly this is the place
>> qmp_query_command_line_options is looking for supported options.
>>
>> As a fix for for 2.3 the machine_qemu_opts (the generic ones)
>> are restored only for qemu-config scope.
>> We need to find a better fix for 2.4.
>>
>> Reported-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>> ---
>
>> + },{
>> + .name = "firmware",
>> + .type = QEMU_OPT_STRING,
>> + .help = "firmware image",
>> + },{
>> + .name = "iommu",
>> + .type = QEMU_OPT_BOOL,
>> + .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
>> + },{
>> + .name = "suppress-vmdesc",
>> + .type = QEMU_OPT_BOOL,
>> + .help = "Set on to disable self-describing migration",
>> + },
>
> No longer a strict superset of the Fedora 21 qemu-kvm, which had:
>
> "parameters": [
> {
> "name": "max-ram-below-4g",
> "help": "maximum ram below the 4G boundary (32bit
> boundary)"
> ,
> "type": "size"
> },
> {
> "name": "kvm-type",
> "help": "Specifies the KVM virtualization mode (HV,
> PR)",
> "type": "string"
> },
> {
> "name": "firmware",
> "help": "firmware image",
> "type": "string"
> },
>
> (remembering that query-command-line-options does things in reverse
> order). I don't think iommu and suppress-vmdesc hurt to add, but we
> shouldn't lose kvm-type or max-ram-below-4g, if those were advertised at
> the point prior to the QemuOpts conversion. (I didn't actually
> research, though, whether I'm comparing against downstream Fedora
> qemu-kvm patches instead of upstream...)
Hmm, in 2.3 kvm-type and max-ram-below-4g are machine specific.
I only took the ones from hw/core/machine.c that are common to all machines.
As you said, this approach does the best to not lie to libvirt...
Thanks,
Marcel
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options
2015-04-01 17:36 ` Marcel Apfelbaum
@ 2015-04-01 18:20 ` Eric Blake
0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2015-04-01 18:20 UTC (permalink / raw)
To: Marcel Apfelbaum, qemu-devel; +Cc: pbonzini, akrowiak, armbru
[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]
On 04/01/2015 11:36 AM, Marcel Apfelbaum wrote:
> On 04/01/2015 08:29 PM, Eric Blake wrote:
>> On 04/01/2015 10:47 AM, Marcel Apfelbaum wrote:
>>> Commit 49d2e64 (machine: remove qemu_machine_opts global list)
>>> made machine options specific to machine sub-type, leaving
>>> the qemu_machine_opts desc array empty. Sadly this is the place
>>> qmp_query_command_line_options is looking for supported options.
>>>
>>> As a fix for for 2.3 the machine_qemu_opts (the generic ones)
>>> are restored only for qemu-config scope.
>>> We need to find a better fix for 2.4.
>>>
>>> Reported-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
>>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>>> ---
>>
>> No longer a strict superset of the Fedora 21 qemu-kvm, which had:
>>
>> "parameters": [
>> {
>> "name": "max-ram-below-4g",
>> "name": "kvm-type",
>> (remembering that query-command-line-options does things in reverse
>> order). I don't think iommu and suppress-vmdesc hurt to add, but we
>> shouldn't lose kvm-type or max-ram-below-4g, if those were advertised at
>> the point prior to the QemuOpts conversion. (I didn't actually
>> research, though, whether I'm comparing against downstream Fedora
>> qemu-kvm patches instead of upstream...)
> Hmm, in 2.3 kvm-type and max-ram-below-4g are machine specific.
> I only took the ones from hw/core/machine.c that are common to all
> machines.
> As you said, this approach does the best to not lie to libvirt...
And luckily, libvirt is not (currently) looking for either 'kvm-type' or
'max-ram-below-4g'. So, I can live with this, and from the point of
view of libvirt's interaction with qemu:
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options
2015-04-01 16:47 [Qemu-devel] [PATCH V2 for-2.3] util/qemu-config: fix regression of qmp_query_command_line_options Marcel Apfelbaum
2015-04-01 17:27 ` Marcel Apfelbaum
2015-04-01 17:29 ` Eric Blake
@ 2015-04-02 12:38 ` Paolo Bonzini
2 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2015-04-02 12:38 UTC (permalink / raw)
To: Marcel Apfelbaum, qemu-devel; +Cc: akrowiak, armbru
On 01/04/2015 18:47, Marcel Apfelbaum wrote:
> Commit 49d2e64 (machine: remove qemu_machine_opts global list)
> made machine options specific to machine sub-type, leaving
> the qemu_machine_opts desc array empty. Sadly this is the place
> qmp_query_command_line_options is looking for supported options.
>
> As a fix for for 2.3 the machine_qemu_opts (the generic ones)
> are restored only for qemu-config scope.
> We need to find a better fix for 2.4.
>
> Reported-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> v1->v2:
> Addressed Eric Blake's and Markus Armbruster's comments:
> - Left only generic options (and not the per-machine options) in machine_qemu_opts.
> - Corrected some spelling errors.
>
> util/qemu-config.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 81 insertions(+)
>
> diff --git a/util/qemu-config.c b/util/qemu-config.c
> index f3463df..2d32ce7 100644
> --- a/util/qemu-config.c
> +++ b/util/qemu-config.c
> @@ -6,6 +6,7 @@
> #include "hw/qdev.h"
> #include "qapi/error.h"
> #include "qmp-commands.h"
> +#include "hw/i386/pc.h"
>
> static QemuOptsList *vm_config_groups[32];
> static QemuOptsList *drive_config_groups[4];
> @@ -148,6 +149,84 @@ static CommandLineParameterInfoList *get_drive_infolist(void)
> return head;
> }
>
> +/* restore machine options that are now machine's properties */
> +static QemuOptsList machine_opts = {
> + .merge_lists = true,
> + .head = QTAILQ_HEAD_INITIALIZER(machine_opts.head),
> + .desc = {
> + {
> + .name = "type",
> + .type = QEMU_OPT_STRING,
> + .help = "emulated machine"
> + },{
> + .name = "accel",
> + .type = QEMU_OPT_STRING,
> + .help = "accelerator list",
> + },{
> + .name = "kernel_irqchip",
> + .type = QEMU_OPT_BOOL,
> + .help = "use KVM in-kernel irqchip",
> + },{
> + .name = "kvm_shadow_mem",
> + .type = QEMU_OPT_SIZE,
> + .help = "KVM shadow MMU size",
> + },{
> + .name = "kernel",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux kernel image file",
> + },{
> + .name = "initrd",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux initial ramdisk file",
> + },{
> + .name = "append",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux kernel command line",
> + },{
> + .name = "dtb",
> + .type = QEMU_OPT_STRING,
> + .help = "Linux kernel device tree file",
> + },{
> + .name = "dumpdtb",
> + .type = QEMU_OPT_STRING,
> + .help = "Dump current dtb to a file and quit",
> + },{
> + .name = "phandle_start",
> + .type = QEMU_OPT_NUMBER,
> + .help = "The first phandle ID we may generate dynamically",
> + },{
> + .name = "dt_compatible",
> + .type = QEMU_OPT_STRING,
> + .help = "Overrides the \"compatible\" property of the dt root node",
> + },{
> + .name = "dump-guest-core",
> + .type = QEMU_OPT_BOOL,
> + .help = "Include guest memory in a core dump",
> + },{
> + .name = "mem-merge",
> + .type = QEMU_OPT_BOOL,
> + .help = "enable/disable memory merge support",
> + },{
> + .name = "usb",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on/off to enable/disable usb",
> + },{
> + .name = "firmware",
> + .type = QEMU_OPT_STRING,
> + .help = "firmware image",
> + },{
> + .name = "iommu",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
> + },{
> + .name = "suppress-vmdesc",
> + .type = QEMU_OPT_BOOL,
> + .help = "Set on to disable self-describing migration",
> + },
> + { /* End of list */ }
> + }
> +};
> +
> CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
> const char *option,
> Error **errp)
> @@ -162,6 +241,8 @@ 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);
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread