This series adds a QAPI type for the properties of all user creatable
QOM types and finally makes the --object command line option (in all
binaries) and the object-add monitor commands (in QMP and HMP) use the
new ObjectOptions union.
This change improves things in more than just one way:
1. Documentation for QOM object types has always been lacking. Adding
the schema, we get documentation for every property.
2. It prevents bugs by performing parts of the input validation (e.g.
checking presence of mandatory properties) already in QAPI instead of
relying on separate manual implementations in each class.
3. It provides QAPI introspection for user creatable objects.
4. Non-scalar properties are now supported everywhere because the
command line parsers (including HMP) use the keyval parser now.
If you are in the CC list and didn't expect this series, it's probably
because you're the maintainer of one of the objects for which I'm adding
a QAPI schema description. Please just have a look at the specific patch
for your object and check whether the schema and its documentation make
sense to you. You can ignore all other patches.
In a next step after this series, we can add make use of the QAPI
structs in the implementation of the object and separate their
configuration from the runtime state. Specifically, the plan is to
add a .configure() callback to ObjectClass that allows configuring the
object in one place at creation time and keeping QOM property setters
only for properties that can actually be changed at runtime. Paolo made
an example of what the state could look like after this:
https://wiki.qemu.org/Features/QOM-QAPI_integration
Finally, the intention is to extend the QAPI schema to have separate
'object' entities and generate some of the code that was written
manually in the intermediate state before.
This series is available as a git tag at:
https://repo.or.cz/qemu/kevin.git qapi-object-v2
v2:
- Convert not only object-add, but all external interfaces so that the
schema will always be enforced and mismatch between implementation and
schema can't go unnoticed.
- Rebased, covering properties and object types added since v1 (yes,
things do become outdated rather quickly when you touch all user
creatable objects)
- Changed the "Since:" version number in the schema documentation to
refer to the version when the object was introduced rather than 6.0
where the schema will (hopefully) be added
- Probably some other minor changes
Kevin Wolf (31):
tests: Drop 'props' from object-add calls
qapi/qom: Drop deprecated 'props' from object-add
qapi/qom: Add ObjectOptions for iothread
qapi/qom: Add ObjectOptions for authz-*
qapi/qom: Add ObjectOptions for cryptodev-*
qapi/qom: Add ObjectOptions for dbus-vmstate
qapi/qom: Add ObjectOptions for memory-backend-*
qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened'
qapi/qom: Add ObjectOptions for throttle-group
qapi/qom: Add ObjectOptions for secret*, deprecate 'loaded'
qapi/qom: Add ObjectOptions for tls-*, deprecate 'loaded'
qapi/qom: Add ObjectOptions for can-*
qapi/qom: Add ObjectOptions for colo-compare
qapi/qom: Add ObjectOptions for filter-*
qapi/qom: Add ObjectOptions for pr-manager-helper
qapi/qom: Add ObjectOptions for confidential-guest-support
qapi/qom: Add ObjectOptions for input-*
qapi/qom: Add ObjectOptions for x-remote-object
qapi/qom: QAPIfy object-add
qom: Make "object" QemuOptsList optional
qemu-storage-daemon: Implement --object with qmp_object_add()
qom: Remove user_creatable_add_dict()
qom: Factor out user_creatable_process_cmdline()
qemu-io: Use user_creatable_process_cmdline() for --object
qemu-img: Use user_creatable_process_cmdline() for --object
qemu-nbd: Use user_creatable_process_cmdline() for --object
qom: Add user_creatable_add_from_str()
hmp: QAPIfy object_add
qom: Add user_creatable_parse_str()
vl: QAPIfy -object
qom: Drop QemuOpts based interfaces
qapi/authz.json | 62 +++
qapi/block-core.json | 27 ++
qapi/common.json | 52 +++
qapi/crypto.json | 159 +++++++
qapi/machine.json | 22 +-
qapi/net.json | 20 -
qapi/qom.json | 639 ++++++++++++++++++++++++++-
qapi/ui.json | 13 +-
docs/system/deprecated.rst | 25 +-
docs/system/removed-features.rst | 5 +
include/qom/object_interfaces.h | 106 ++---
hw/block/xen-block.c | 16 +-
monitor/hmp-cmds.c | 17 +-
monitor/misc.c | 2 -
qemu-img.c | 239 ++--------
qemu-io.c | 33 +-
qemu-nbd.c | 34 +-
qom/object_interfaces.c | 168 +++----
qom/qom-qmp-cmds.c | 28 +-
softmmu/vl.c | 109 +++--
storage-daemon/qemu-storage-daemon.c | 25 +-
tests/check-qom-proplist.c | 42 +-
tests/qtest/qmp-cmd-test.c | 16 +-
tests/qtest/test-netfilter.c | 54 +--
hmp-commands.hx | 2 +-
storage-daemon/qapi/qapi-schema.json | 1 +
tests/qemu-iotests/087 | 8 +-
tests/qemu-iotests/184 | 18 +-
tests/qemu-iotests/218 | 2 +-
tests/qemu-iotests/235 | 2 +-
tests/qemu-iotests/245 | 4 +-
tests/qemu-iotests/258 | 6 +-
tests/qemu-iotests/258.out | 4 +-
tests/qemu-iotests/295 | 2 +-
tests/qemu-iotests/296 | 2 +-
35 files changed, 1270 insertions(+), 694 deletions(-)
--
2.29.2