Skip to contentSkip to conversation

util/qemu-config" fix regression of qmp_query_command_line_options

PATCH Superseded Marcel Apfelbaum 4 participants 6 messages Apr 1, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 util/qemu-config" fix regression of qmp_query_command_line_options

Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine 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 are restored only for the scope of qemu-config, bringing together all machines properties. We need to find a better fix for 2.4.

---

I don't like this approach, but I wouldn't want to loose the 'options per machine type' feature. We'll find something better for 2.4/

 util/qemu-config.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
util/qemu-config.c +108 -0
index f3463df..9e8edda 100644
@@ -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,111 @@ 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 = "kvm-type",
+            .type = QEMU_OPT_STRING,
+            .help = "Specifies the KVM virtualization mode (HV, PR)",
+        },{
+            .name = PC_MACHINE_MAX_RAM_BELOW_4G,
+            .type = QEMU_OPT_SIZE,
+            .help = "maximum ram below the 4G boundary (32bit boundary)",
+        },{
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_STRING,
+            .help = "Enable vmport (pc & q35)",
+        },{
+            .name = "iommu",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
+        },{
+            .name = "secure",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on/off to enable/disable the ARM "
+                    "Security Extensions (TrustZone)",
+        },{
+            .name = "suppress-vmdesc",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on to disable self-describing migration",
+        },{
+            .name = "aes-key-wrap",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable AES key wrapping using the "
+                    "CPACF wrapping key",
+        },{
+            .name = "dea-key-wrap",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable DEA key wrapping using the "
+                    "CPACF wrapping key",
+        },
+        { /* End of list */ }
+    }
+};
+
 CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
                                                           const char *option,
                                                           Error **errp)
@@ -162,6 +268,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);
Signature · 1 line
2.1.0
#1 lore raw

I noticed the typo in subject :) maybe the maintainer that will take it can fix this if no further work is necessary, of course.

Quoted 10 lines · Marcel Apfelbaum

Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine 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 are restored only for the scope of qemu-config, bringing together all machines properties. We need to find a better fix for 2.4.

Hi Tony,
I'll appreciate if you check that it works now.

I checked query-command-line-options and it returns the machine options for now. No further changes should be necessary,

Thanks,
Marcel

Quoted 143 lines

---

I don't like this approach, but I wouldn't want to loose the 'options per machine type' feature. We'll find something better for 2.4/

  util/qemu-config.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 108 insertions(+)
util/qemu-config.c +108 -0
index f3463df..9e8edda 100644
@@ -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,111 @@ 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 = "kvm-type",
+            .type = QEMU_OPT_STRING,
+            .help = "Specifies the KVM virtualization mode (HV, PR)",
+        },{
+            .name = PC_MACHINE_MAX_RAM_BELOW_4G,
+            .type = QEMU_OPT_SIZE,
+            .help = "maximum ram below the 4G boundary (32bit boundary)",
+        },{
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_STRING,
+            .help = "Enable vmport (pc & q35)",
+        },{
+            .name = "iommu",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
+        },{
+            .name = "secure",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on/off to enable/disable the ARM "
+                    "Security Extensions (TrustZone)",
+        },{
+            .name = "suppress-vmdesc",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on to disable self-describing migration",
+        },{
+            .name = "aes-key-wrap",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable AES key wrapping using the "
+                    "CPACF wrapping key",
+        },{
+            .name = "dea-key-wrap",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable DEA key wrapping using the "
+                    "CPACF wrapping key",
+        },
+        { /* End of list */ }
+    }
+};
+
  CommandLineOptionInfoList *qmp_query_command_line_options(bool has_option,
                                                            const char *option,
                                                            Error **errp)
@@ -162,6 +268,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);
#2 lore raw
Quoted 14 lines · Marcel Apfelbaum

I noticed the typo in subject :) maybe the maintainer that will take it can fix this if no further work is necessary, of course.

Quoted 10 lines · Marcel Apfelbaum

Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine 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 are restored only for the scope of qemu-config, bringing together all machines properties. We need to find a better fix for 2.4.

Quoted 8 lines

Hi Tony,
I'll appreciate if you check that it works now.

I checked query-command-line-options and it returns the machine options for now. No further changes should be necessary,

Thanks,
Marcel

Marcel,

I installed your patch on my system and it resolved the problem I was seeing. I'm looking forward to seeing how you are going to resolve this per machine.

Tony Krowiak

Quoted 152 lines
Quoted 151 lines

---

I don't like this approach, but I wouldn't want to loose the 'options per machine type' feature. We'll find something better for 2.4/

  util/qemu-config.c | 108 
+++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 108 insertions(+)
util/qemu-config.c +106 -0
index f3463df..9e8edda 100644
@@ -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,111 @@ 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 = "kvm-type",
+            .type = QEMU_OPT_STRING,
+            .help = "Specifies the KVM virtualization mode (HV, PR)",
+        },{
+            .name = PC_MACHINE_MAX_RAM_BELOW_4G,
+            .type = QEMU_OPT_SIZE,
+            .help = "maximum ram below the 4G boundary (32bit 
 boundary)",
+        },{
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_STRING,
+            .help = "Enable vmport (pc & q35)",
+        },{
+            .name = "iommu",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on/off to enable/disable Intel IOMMU (VT-d)",
+        },{
+            .name = "secure",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on/off to enable/disable the ARM "
+                    "Security Extensions (TrustZone)",
+        },{
+            .name = "suppress-vmdesc",
+            .type = QEMU_OPT_BOOL,
+            .help = "Set on to disable self-describing migration",
+        },{
+            .name = "aes-key-wrap",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable AES key wrapping using the "
+                    "CPACF wrapping key",
+        },{
+            .name = "dea-key-wrap",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable DEA key wrapping using the "
+                    "CPACF wrapping key",
+        },
+        { /* End of list */ }
+    }
+};
+

CommandLineOptionInfoList *qmp_query_command_line_options(bool
has_option,
const char *option,
Error **errp)

util/qemu-config.c +2 -0
@@ -162,6 +268,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);

Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Marcel Apfelbaum
Quoted 2 lines · Marcel Apfelbaum

Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine machine options specific to machine sub-type, leaving

At the risk of sounding like a machine: s/machine machine/machine/

Quoted 5 lines

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 are restored only for the scope of qemu-config, bringing together all machines

s/machines/machines'/

Quoted 11 lines

properties. We need to find a better fix for 2.4.

---

I don't like this approach, but I wouldn't want to loose the 'options per machine type' feature. We'll find something better for 2.4/

 util/qemu-config.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)

It's a hack, but it avoids a regression.

I also tested that query-command-line-options on qemu.git + this patch provided a superset of the options exposed by 2:qemu-system-x86-2.1.3-3.fc21.x86_64 as installed on Fedora 21, while without this patch it had no options.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#4 lore raw
Quoted 6 lines · Eric Blake
Quoted 2 lines · Marcel Apfelbaum

Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine machine options specific to machine sub-type, leaving

At the risk of sounding like a machine: s/machine machine/machine/

Quoted 9 lines
Quoted 5 lines

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 are restored only for the scope of qemu-config, bringing together all machines

s/machines/machines'/

Quoted 1 line

properties. We need to find a better fix for 2.4.

As discussed on the other thread, we may want a v2:

Quoted 4 lines

I also tested that query-command-line-options on qemu.git + this patch provided a superset of the options exposed by 2:qemu-system-x86-2.1.3-3.fc21.x86_64 as installed on Fedora 21, while without this patch it had no options.

The problem is that the superset includes per-machine options, even for machines where they don't apply. I think it's better for 2.3 to be conservative (advertise no less than before, so we don't regress) than to lie (advertising something we don't support is risky).

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#5 lore raw
Quoted 10 lines · Eric Blake
Quoted 9 lines · Eric Blake
Quoted 2 lines · Marcel Apfelbaum

Commit 49d2e64 (machine: remove qemu_machine_opts global list) made machine machine options specific to machine sub-type, leaving

At the risk of sounding like a machine: s/machine machine/machine/

Quoted 3 lines

the qemu_machine_opts desc array empty. Sadly this is the place qmp_query_command_line_options is looking for supported options.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

As a fix for for 2.3 the machine_qemu_opts are restored only for the scope of qemu-config, bringing together all machines

s/machines/machines'/

Quoted 1 line

properties. We need to find a better fix for 2.4.

Hi Eric,
Thank you for your help.

Quoted 2 lines

As discussed on the other thread, we may want a v2:

Submitted.

Quoted 11 lines
Quoted 6 lines

I also tested that query-command-line-options on qemu.git + this patch provided a superset of the options exposed by 2:qemu-system-x86-2.1.3-3.fc21.x86_64 as installed on Fedora 21, while without this patch it had no options.

The problem is that the superset includes per-machine options, even for machines where they don't apply. I think it's better for 2.3 to be conservative (advertise no less than before, so we don't regress) than to lie (advertising something we don't support is risky).

I agree, this is the reason we wanted per-machine options, to not lie to higher levels.

Thanks,
Marcel

Quoted 1 line