From: Markus Armbruster <armbru@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org, "Michael Roth" <michael.roth@amd.com>,
"John Snow" <jsnow@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Eric Blake" <eblake@redhat.com>
Subject: ObjectPropertyInfo design (was: [PATCH v7 00/65] Hi)
Date: Thu, 22 Oct 2026 16:04:44 +0200 [thread overview]
Message-ID: <87ik2tj0g3.fsf@pond.sub.org> (raw)
In-Reply-To: <20261020-qom-qapi-v7-0-431a86b02b58@redhat.com> (marcandre lureau's message of "Tue, 20 Oct 2026 14:45:17 +0400")
Marc-André's series evolves ObjectPropertyInfo and ObjectPropertyValue:
it adds member @qapi-type and changes many values of member @type.
I'd like to take a step back and discuss design. I trimmed Cc:
accordingly.
= The current interface
qom-list returns information on an object's properties, one
ObjectPropertyInfo per property.
qom-list-properties returns information on properties an instance of a
type is known to have[*], one ObjectPropertyInfo per property.
qom-list-get returns information on the properties of several objects,
one ObjectPropertyValue per property.
ObjectPropertyInfo and ObjectPropertyValue provide @name and @type.
ObjectPropertyInfo additionally provides @description and
@default-value, both optional.
ObjectPropertyValue additionally provides optional @value, absent when
the property cannot be read.
If ObjectPropertyValue was an extension of ObjectPropertyInfo, then
qom-list-get would be a strictly more powerful version of qom-list.
It isn't. However, I think the information lost when moving from
qom-list to qom-list-get is not useful:
* @description is rarely present (I see under 15% in a quick test). The
description text is commonly misleading for QMP. For instance, qdev
bool properties have description "on/off". The possible values are
actually JSON false and true.
* @default-value can be useful with qom-list-properties, which operates
on types. I doubt it is with qom-list, which operates on objects.
Let's pretend @description doesn't exist, and @default-value exists only
with qom-list-properties.
This makes qom-list-get strictly more powerful than qom-list, so let's
further pretend qom-list doesn't exist.
= Simplified interface for the sake of discussion
qom-list-properties returns information on properties an instance of a
type is known to have[*]: @name, @type, and maybe @default-value.
qom-list-get returns information on the properties of several objects:
@name, @type, and maybe @value.
= The meaning of @type
Three cases:
1. For a child property (created with object_property_add_child() etc.),
@type is "child<T>", where T is the child's QOM type.
2. For a link property (created with object_class_property_add_link()
etc.), @type is "link<T>", where T is the target's QOM type.
3. For other properties, @type can be anything. We commonly use QAPI
type names (occasionally misspelled), and also "well-known" (but
undocumented) non-QAPI names for primitive types. Every now and
then, developers get lazy and use values like "list", or creative and
use values like "guest statistics". Nobody has gotten sufficiently
masochistic to use values starting with "child<" or "link<" so far,
although nothing would stop that.
Cases 1 and 2 go against the QAPI/QMP design maxim "don't encode stuff
in strings".
Case 3 is is hard to use for anything. You're forced into stupid and
brittle hardcoding.
Marc-André's work adds a new optional member @qapi_type that refers to a
QAPI type in the output of query-qmp-schema. It's present for a large
subset of case 3. When it's present, @type should not be used.
It also cleans up many crap cases of 3, but without making it robust. I
understand this isn't something the series tries to do, it's just
something that's easier to do than not to do. If it creates
compatibility problems, we have to not do it. I hope it doesn't.
= Can we do better?
What information are we trying to convey? Four cases:
1. Child property: the child's QOM type
2. Link property: the target's QOM type
3. QAPI-backed property: the property's QAPI type
4. Other property: we have nothing useful to offer
Case 4 should go away eventually.
How would we encode this in QAPI on a green field? With a union, of
course:
{ 'enum': 'ObjectPropertyKind',
'data': [ 'child', 'link', 'qapi', 'other'] }
{ 'struct': 'ObjectPropertyInfoLink',
'data': { 'qom-type': 'str' } }
{ 'struct': 'ObjectPropertyInfoQAPI',
'data': { 'qapi-type': 'str' } }
{ 'union': 'ObjectProperty...',
'base': { 'kind': 'ObjectPropertyKind',
... more ... },
'discriminator': 'kind',
'data': {
'child': 'ObjectPropertyInfoLink',
'link': 'ObjectPropertyInfoLink',
'qapi': 'ObjectPropertyInfoQAPI' } }
To make this a compatible evolution of ObjectPropertyInfo, we need
... more ... to be
'type': 'str',
'*description': 'str'
'*default-value': 'any',
Sadly, we need to duplicate the union for ObjectPropertyValue. There,
... more ... needs to be
'type': 'str',
'*value': 'any'
We should deprecate @type. I'd also deprecate @description.
Thoughts?
[*] It may have more; see the note in the doc comment of
qom-list-properties.
next prev parent reply other threads:[~2026-10-22 14:05 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 10:45 [PATCH v7 00/65] Hi marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 01/65] qapi/schema: Rename .lookup_entity() and tighten return type marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 02/65] qapi: Ease access to introspection names marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 03/65] qapi/introspect: Simplify masked name comment emission slighly marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 04/65] qapi/introspect: Don't elide types marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 05/65] qapi: QAPISchemaVisitor.visit_needed() is now unused, drop marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 06/65] qapi/introspect: Tweak integer type masking marcandre.lureau
2026-10-20 10:45 ` [PATCH v7 07/65] qapi: add QAPITypeInfo struct definition Marc-André Lureau
2026-10-23 8:39 ` Markus Armbruster
2026-10-20 10:45 ` [PATCH v7 08/65] qapi/gen: fix _module_basename for multi-dash 'what' parameters Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 09/65] qapi: add type-infos generator Marc-André Lureau
2026-10-23 13:47 ` Markus Armbruster via qemu development
2026-10-23 13:47 ` Markus Armbruster via
2026-10-23 13:47 ` Markus Armbruster via
2026-10-23 13:47 ` Markus Armbruster
2026-10-20 10:45 ` [PATCH v7 10/65] meson: add qapi-type-infos-*.c/h to build Marc-André Lureau
2026-10-23 10:54 ` Markus Armbruster
2026-10-20 10:45 ` [PATCH v7 11/65] qom: add qapi_type field to ObjectProperty Marc-André Lureau
2026-10-23 13:54 ` Markus Armbruster
2026-10-20 10:45 ` [PATCH v7 12/65] qapi/qom: add qapi-type field to ObjectPropertyInfo Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 13/65] qom/qmp: populate qapi-type in QMP handlers Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 14/65] qom/qmp: populate description & default-value in qom_property_info() Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 15/65] qom: add object_property_set_default_enum() Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 16/65] qom: add object_{class_}property_add_qapi Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 17/65] qom: add object_{class_}property_add_qapi_enum Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 18/65] tests: update check-qom-proplist for QAPI-aware property registration Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 19/65] qom: convert QAPI enum properties to QAPI-aware registration Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 20/65] qom: convert struct " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 21/65] x86: convert OnOffAuto " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 22/65] microvm: " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 23/65] pc: convert OnOffAuto vmport property " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 24/65] arm/virt: convert OnOffAuto acpi " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 25/65] riscv/virt: convert OnOffAuto properties " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 26/65] loongarch/virt: " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 27/65] hostmem-file: convert OnOffAuto rom property " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 28/65] sev: convert OnOffAuto legacy-vm-type " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 29/65] whpx: convert OnOffAuto hyperv " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 30/65] whpx: convert OnOffAuto arch properties " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 31/65] accel/kvm: convert OnOffSplit property " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 32/65] whpx: " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 33/65] hw/ppc/spapr_caps: fix property type name Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 34/65] ppc/spapr-caps: convert to QAPI-aware property registration Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 35/65] net/colo-compare: fix compare_timeout setter visitor type Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 36/65] net/colo-compare: fix max_queue_size " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 37/65] hw/misc/xlnx-versal-trng: add missing getter for fips-fault-events Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 38/65] qom: convert scalar properties to QAPI-aware registration Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 39/65] i386/cpu: convert strList property " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 40/65] accel/hvf: convert OnOffSplit " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 41/65] i386/x86: convert SgxEPCList " Marc-André Lureau
2026-10-20 10:45 ` [PATCH v7 42/65] virtio-balloon: convert guest-stats property to QAPI type Marc-André Lureau
2026-10-20 12:59 ` Markus Armbruster
2026-10-20 10:46 ` [PATCH v7 43/65] qom: replace object_property_add_tm with StructTm " Marc-André Lureau
2026-10-20 13:25 ` Markus Armbruster
2026-10-20 10:46 ` [PATCH v7 44/65] hw/nvdimm: convert UUID property to QAPI-aware registration Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 45/65] hw/s390-virtio-ccw: convert loadparm " Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 46/65] hw/ppc/spapr_drc: convert fdt " Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 47/65] hw/s390x: convert BootCertificatesList " Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 48/65] hw/gpio/pca955x: use QAPI enums for led and pin properties Marc-André Lureau
2026-10-20 20:28 ` Miles Glenn
2026-10-20 10:46 ` [PATCH v7 49/65] include: add QEMU_REPEAT helper macro Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 50/65] hw/gpio/pca955x: convert pin/led property to QAPI-aware enum Marc-André Lureau
2026-10-20 20:41 ` Miles Glenn
2026-10-20 10:46 ` [PATCH v7 51/65] hw/pci: change the busnr type to uint8 Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 52/65] qdev: add qapi_type field to PropertyInfo with fallback registration Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 53/65] qdev: convert core PropertyInfo definitions to use qapi_type Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 54/65] qdev: adjust PciDevfn declared type Marc-André Lureau
2026-10-23 10:04 ` Daniel P. Berrangé
2026-10-23 11:39 ` Marc-André Lureau
2026-10-23 12:04 ` Michael S. Tsirkin
2026-10-27 14:54 ` Markus Armbruster
2026-10-27 15:08 ` Daniel P. Berrangé
2026-10-28 7:13 ` Markus Armbruster
2026-10-20 10:46 ` [PATCH v7 55/65] qdev: convert system PropertyInfo definitions to use qapi_type Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 56/65] hw: convert device-local " Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 57/65] target/riscv: convert " Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 58/65] qdev: " Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 59/65] qdev: introduce typed array PropertyInfos Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 60/65] qdev: simplify DEFINE_PROP_ARRAY and remove generic array PropertyInfo Marc-André Lureau
2026-10-21 14:45 ` Markus Armbruster
2026-10-20 10:46 ` [PATCH v7 61/65] qdev: remove deprecated PropertyInfo.type and .enum_table fields Marc-André Lureau
2026-10-29 10:30 ` Markus Armbruster
2026-10-20 10:46 ` [PATCH v7 62/65] hw/i386: convert PCSouthBridgeOption to QAPI enum Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 63/65] qom: remove old enum property registration API Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 64/65] qom: use QAPITypeInfo in object_property_get_enum Marc-André Lureau
2026-10-20 10:46 ` [PATCH v7 65/65] tests/qmp-cmd-test: assert qapi-type resolves in query-qmp-schema Marc-André Lureau
2026-10-21 16:29 ` Property types changed in this series (was: [PATCH v7 00/65] Hi) Markus Armbruster
2026-10-22 6:49 ` Property types changed in this series Markus Armbruster
2026-10-22 8:29 ` Ján Tomko
2026-10-22 14:04 ` Markus Armbruster [this message]
2026-10-23 12:52 ` ObjectPropertyInfo design (was: [PATCH v7 00/65] Hi) Marc-André Lureau
2026-10-28 11:44 ` ObjectPropertyInfo design Markus Armbruster
2026-10-29 13:44 ` Markus Armbruster
2026-10-29 13:54 ` Marc-André Lureau
2026-10-26 17:21 ` ObjectPropertyInfo design (was: [PATCH v7 00/65] Hi) Daniel P. Berrangé
2026-10-28 13:39 ` ObjectPropertyInfo design Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ik2tj0g3.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.