vl: Add opts to device opts list when using JSON syntax for -device
PATCH 1/1 vl: Add opts to device opts list when using JSON syntax for -device
When using JSON syntax for -device, -set option can not find device specified in JSON by id field. The following commandline is an example:
$ qemu-system-x86_64 -device '{"id":"foo"}' -set device.foo.bar=1
qemu-system-x86_64: -set device.foo.bar=1: there is no device "foo" definedThe patch adds device opts to device opts list when a device opts get parsed.
--- softmmu/vl.c | 2 ++ 1 file changed, 2 insertions(+)
softmmu/vl.c +2 -0
@@ -3400,6 +3400,8 @@ void qemu_init(int argc, char **argv, char **envp)loc_save (&opt->loc);assert (opt->opts !=NULL );QTAILQ_INSERT_TAIL (&device_opts, opt, next); +qemu_opts_from_qdict (qemu_find_opts_err ("device" , &error_fatal), + opt->opts, &error_fatal); }else {if (!qemu_opts_parse_noisily (qemu_find_opts ("device" ), optarg, true)) {
Signature · 1 line
2.34.1
Cc'ing Markus.
Quoted 10 lines · MkfsSion
When using JSON syntax for -device, -set option can not find device specified in JSON by id field. The following commandline is an example:
$ qemu-system-x86_64 -device '{"id":"foo"}' -set device.foo.bar=1 qemu-system-x86_64: -set device.foo.bar=1: there is no device "foo" definedThe patch adds device opts to device opts list when a device opts get parsed.
Signed-off-by MkfsSion <[email protected]>
BTW per:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line
"Please use your real name to sign a patch (not an alias or acronym)."
Quoted 17 lines
--- softmmu/vl.c | 2 ++ 1 file changed, 2 insertions(+)softmmu/vl.c +2
-0@@ -3400,6 +3400,8 @@ void qemu_init(int argc, char **argv, char **envp)loc_save (&opt->loc);assert (opt->opts !=NULL );QTAILQ_INSERT_TAIL (&device_opts, opt, next); +qemu_opts_from_qdict (qemu_find_opts_err ("device" , &error_fatal), + opt->opts, &error_fatal); }else {if (!qemu_opts_parse_noisily (qemu_find_opts ("device" ), optarg, true)) {
Sorry, the patch is not well tested and it causes duplicate devices creation. I have send another patch to the mailing list to fix the issue.
Quoted 9 lines · Philippe Mathieu-Daudé
Cc'ing Markus.
Quoted 6 lines · MkfsSion
When using JSON syntax for -device, -set option can not find device specified in JSON by id field. The following commandline is an example:
$ qemu-system-x86_64 -device '{"id":"foo"}' -set device.foo.bar=1 qemu-system-x86_64: -set device.foo.bar=1: there is no device "foo" defined
Quoted 8 lines
Quoted 4 lines
The patch adds device opts to device opts list when a device opts get parsed.
Signed-off-by MkfsSion <[email protected]>BTW per:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line
"Please use your real name to sign a patch (not an alias or acronym)."
The issue has been fixed in new patch.
Quoted 19 lines
Quoted 18 lines
--- softmmu/vl.c | 2 ++ 1 file changed, 2 insertions(+)softmmu/vl.c +2
-0@@ -3400,6 +3400,8 @@ void qemu_init(int argc, char **argv, char **envp)loc_save (&opt->loc);assert (opt->opts !=NULL );QTAILQ_INSERT_TAIL (&device_opts, opt, next); +qemu_opts_from_qdict (qemu_find_opts_err ("device" , &error_fatal), + opt->opts, &error_fatal); }else {if (!qemu_opts_parse_noisily (qemu_find_opts ("device" ), optarg, true)) {