mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
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>
This commit is contained in:
parent
f3558b1b76
commit
5dacda5167
2 changed files with 67 additions and 11 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue