aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2021-10-08 15:34:42 +0200
committerKevin Wolf <kwolf@redhat.com>2021-10-15 16:11:22 +0200
commit5dacda5167560b3af8eadbce5814f60ba44b467e (patch)
treee4e2c1b73c3751ecfe1d382a10eab5aef02d274c /qapi
parentf3558b1b763683bb877f7dd5b282469cdadc65c3 (diff)
downloadqemu-5dacda5167560b3af8eadbce5814f60ba44b467e.zip
qemu-5dacda5167560b3af8eadbce5814f60ba44b467e.tar.gz
qemu-5dacda5167560b3af8eadbce5814f60ba44b467e.tar.bz2
vl: Enable JSON syntax for -device
Like we already do for -object, introduce support for JSON syntax in -device, which can be kept stable in the long term and guarantees that a single code path with identical behaviour is used for both QMP and the command line. Compared to the QemuOpts based code, the parser contains less surprises and has support for non-scalar options (lists and structs). Switching management tools to JSON means that we can more easily change the "human" CLI syntax from QemuOpts to the keyval parser later. In the QAPI schema, a feature flag is added to the device-add command to allow management tools to detect support for this. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20211008133442.141332-16-kwolf@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qdev.json15
1 files changed, 11 insertions, 4 deletions
diff --git a/qapi/qdev.json b/qapi/qdev.json
index d75e689..69656b1 100644
--- a/qapi/qdev.json
+++ b/qapi/qdev.json
@@ -32,17 +32,23 @@
##
# @device_add:
#
+# Add a device.
+#
# @driver: the name of the new device's driver
#
# @bus: the device's parent bus (device tree path)
#
# @id: the device's ID, must be unique
#
-# Additional arguments depend on the type.
-#
-# Add a device.
+# Features:
+# @json-cli: If present, the "-device" command line option supports JSON
+# syntax with a structure identical to the arguments of this
+# command.
#
# Notes:
+#
+# Additional arguments depend on the type.
+#
# 1. For detailed information about this command, please refer to the
# 'docs/qdev-device-use.txt' file.
#
@@ -67,7 +73,8 @@
##
{ 'command': 'device_add',
'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
- 'gen': false } # so we can get the additional arguments
+ 'gen': false, # so we can get the additional arguments
+ 'features': ['json-cli'] }
##
# @device_del: