qapi: Flatten object-add

Mapping object-add to the command line as is doesn't result in nice
syntax because of the nesting introduced with 'props'. This becomes
nicer and more consistent with device_add and netdev_add when we accept
properties for the object on the top level instead.

'props' is still accepted after this patch, but marked as deprecated.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200224143008.13362-8-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2020-02-24 15:29:55 +01:00
parent 14837c6493
commit 5f07c4d60d
6 changed files with 68 additions and 11 deletions

View file

@ -210,7 +210,12 @@
#
# @id: the name of the new object
#
# @props: a dictionary of properties to be passed to the backend
# @props: a dictionary of properties to be passed to the backend. Deprecated
# since 5.0, specify the properties on the top level instead. It is an
# error to specify the same option both on the top level and in @props.
#
# Additional arguments depend on qom-type and are passed to the backend
# unchanged.
#
# Returns: Nothing on success
# Error if @qom-type is not a valid class name
@ -221,12 +226,13 @@
#
# -> { "execute": "object-add",
# "arguments": { "qom-type": "rng-random", "id": "rng1",
# "props": { "filename": "/dev/hwrng" } } }
# "filename": "/dev/hwrng" } }
# <- { "return": {} }
#
##
{ 'command': 'object-add',
'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'},
'gen': false } # so we can get the additional arguments
##
# @object-del: