On Tue, 13 Jul 2021 13:43:47 -0600
Alex Williamson <alex.william...@redhat.com> wrote:
On Tue, 6 Jul 2021 12:01:37 +0200
Paolo Bonzini <pbonz...@redhat.com> wrote:
Switch from QemuOpts to keyval. This enables the introduction
of non-scalar machine properties, and JSON syntax in the future.
For JSON syntax to be supported right now, we would have to
consider what would happen if string-based dictionaries (produced by
-M key=val) were to be merged with strongly-typed dictionaries
(produced by -M {'key': 123}).
The simplest way out is to never enter the situation, and only allow one
-M option when JSON syntax is in use. However, we want options such as
-smp to become syntactic sugar for -M, and this is a problem; as soon
as -smp becomes a shortcut for -M, QEMU would forbid using -M '{....}'
together with -smp. Therefore, allowing JSON syntax right now for -M
would be a forward-compatibility nightmare and it would be impossible
anyway to introduce -M incrementally in tools.
Instead, support for JSON syntax is delayed until after the main
options are converted to QOM compound properties. These include -boot,
-acpitable, -smbios, -m, -semihosting-config, -rtc and -fw_cfg. Once JSON
syntax is introduced, these options will _also_ be forbidden together
with -M '{...}'.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
softmmu/vl.c | 315 ++++++++++++++++++++++++---------------------------
1 file changed, 146 insertions(+), 169 deletions(-)
This breaks the below long standing test VM. libvirt log and xml
provided below. I'm using libvirt version 7.3.0.
A trivial reproducer:
qemu-system-x86_64 -blockdev
'{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.fd","node-name":"pflash0-storage","auto-read-only":true,"discard":"unmap"}' -blockdev
'{"node-name":"pflash0-format","read-only":true,"driver":"raw","file":"pflash0-storage"}' -machine pc,pflash0=pflash0-format
backtrace:
#0 error_setg_internal
(errp=0x7fffffffd6c8, src=0x55555618bc10
"../../home/alwillia/Work/qemu.git/qapi/qobject-input-visitor.c", line=172, func=0x55555618bf20
<__func__.27> "qobject_input_get_object", fmt=0x55555618bc98 "Parameter '%s' is missing")
at ../../home/alwillia/Work/qemu.git/util/error.c:93
#1 0x0000555555f8d255 in qobject_input_get_object (qiv=0x5555569c59b0,
name=0x555556920ef0 "drive", consume=true, errp=0x7fffffffd6c8) at
../../home/alwillia/Work/qemu.git/qapi/qobject-input-visitor.c:172
#2 0x0000555555f8d28b in qobject_input_get_keyval (qiv=0x5555569c59b0,
name=0x555556920ef0 "drive", errp=0x7fffffffd6c8) at
../../home/alwillia/Work/qemu.git/qapi/qobject-input-visitor.c:184
#3 0x0000555555f8e3a9 in qobject_input_type_str_keyval (v=0x5555569c59b0,
name=0x555556920ef0 "drive", obj=0x7fffffffd5a8, errp=0x7fffffffd6c8)
at ../../home/alwillia/Work/qemu.git/qapi/qobject-input-visitor.c:551
#4 0x0000555555f59e51 in visit_type_str (v=0x5555569c59b0, name=0x555556920ef0
"drive", obj=0x7fffffffd5a8, errp=0x7fffffffd6c8) at
../../home/alwillia/Work/qemu.git/qapi/qapi-visit-core.c:337
#5 0x00005555558c3b70 in set_drive_helper (obj=0x5555569208a0, v=0x5555569c59b0,
name=0x555556920ef0 "drive", opaque=0x5555564c8300 <pflash_cfi01_properties>,
iothread=false, errp=0x7fffffffd6c8)
at ../../home/alwillia/Work/qemu.git/hw/core/qdev-properties-system.c:97
#6 0x00005555558c3e0b in set_drive (obj=0x5555569208a0, v=0x5555569c59b0, name=0x555556920ef0
"drive", opaque=0x5555564c8300 <pflash_cfi01_properties>, errp=0x7fffffffd6c8)
at ../../home/alwillia/Work/qemu.git/hw/core/qdev-properties-system.c:171
#7 0x0000555555edb821 in field_prop_set (obj=0x5555569208a0, v=0x5555569c59b0,
name=0x555556920ef0 "drive", opaque=0x5555564c8300 <pflash_cfi01_properties>,
errp=0x7fffffffd6c8)
at ../../home/alwillia/Work/qemu.git/hw/core/qdev-properties.c:86
#8 0x0000555555eb7f15 in object_property_set (obj=0x5555569208a0, name=0x555556920ef0
"drive", v=0x5555569c59b0, errp=0x7fffffffd768) at
../../home/alwillia/Work/qemu.git/qom/object.c:1402
#9 0x0000555555ebad9e in property_set_alias (obj=0x55555683dde0, v=0x5555569c59b0,
name=0x5555566fc8a0 "pflash0", opaque=0x555556920ed0, errp=0x7fffffffd768)
at ../../home/alwillia/Work/qemu.git/qom/object.c:2695
#10 0x0000555555eb7f15 in object_property_set (obj=0x55555683dde0, name=0x5555566fc8a0
"pflash0", v=0x5555569c59b0, errp=0x7fffffffd7b8) at
../../home/alwillia/Work/qemu.git/qom/object.c:1402
#11 0x0000555555eb3aa3 in object_set_properties_from_qdict (obj=0x55555683dde0,
qdict=0x5555566fa5b0, v=0x5555569c59b0, errp=0x5555565d9308 <error_fatal>)
at ../../home/alwillia/Work/qemu.git/qom/object_interfaces.c:55
#12 0x0000555555eb3bc3 in object_set_properties_from_keyval (obj=0x55555683dde0,
qdict=0x5555566fa5b0, from_json=false, errp=0x5555565d9308 <error_fatal>)
at ../../home/alwillia/Work/qemu.git/qom/object_interfaces.c:79
#13 0x0000555555cb3f5f in qemu_apply_machine_options (qdict=0x5555566fa5b0) at
../../home/alwillia/Work/qemu.git/softmmu/vl.c:1833
#14 0x0000555555cb8606 in qemu_init (argc=7, argv=0x7fffffffdae8,
envp=0x7fffffffdb28) at ../../home/alwillia/Work/qemu.git/softmmu/vl.c:3634
#15 0x00005555558326d1 in main (argc=7, argv=0x7fffffffdae8,
envp=0x7fffffffdb28) at ../../home/alwillia/Work/qemu.git/softmmu/main.c:49