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-v3
v3:
- Removed now useless QAuthZListRuleListHack
- Made some more ObjectOptions branches conditional
- Improved documentation for some properties
- Fixed 'qemu-img compare' exit code for option parsing failure
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 (30):
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-nbd: Use user_creatable_process_cmdline() for --object
qom: Add user_creatable_add_from_str()
qemu-img: Use user_creatable_process_cmdline() for --object
hmp: QAPIfy object_add
qom: Add user_creatable_parse_str()
vl: QAPIfy -object
qom: Drop QemuOpts based interfaces
qapi/authz.json | 61 ++-
qapi/block-core.json | 27 ++
qapi/common.json | 52 +++
qapi/crypto.json | 159 +++++++
qapi/machine.json | 22 +-
qapi/net.json | 20 -
qapi/qom.json | 644 ++++++++++++++++++++++++++-
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 | 251 ++---------
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 | 27 +-
tests/check-qom-proplist.c | 42 +-
hmp-commands.hx | 2 +-
storage-daemon/qapi/qapi-schema.json | 1 +
24 files changed, 1231 insertions(+), 633 deletions(-)
--
2.29.2