08.06.2021 14:12, Markus Armbruster wrote:
Vladimir Sementsov-Ogievskiy <vsementsov(a)virtuozzo.com>
writes:
[...]
> TODO: We also need to deprecate drive-backup transaction action..
> But union members in QAPI doesn't support 'deprecated' feature. I tried
> to dig a bit, but failed :/ Markus, could you please help with it? At
> least by advice?
There are two closely related things in play here: the union branch and
the corresponding enum value.
So far, the QAPI schema language doesn't support tacking feature flags
to either.
If an enum value is deprecated, any union branches corresponding to it
must also be deprecated (because their use requires using the deprecated
enum value).
The converse is not true, but I can't see a use for deprecating a union
branch without also deprecating the enum member.
I think we can implement feature flags just for enum members, then
document that 'deprecated' enum value implies corresponding union
branches are also deprecated.
I have unfinished patches implementing feature flags for enum members.
Since TransactionAction is a simple union, the corresponding enum is
implicit. We can make it explicit by converting to a flat union.
Simple unions need to die anyway.
Does BlockStatsSpecific from qapi/block-core.json a correct example of flat union you
mean? I can make patch to convert TransactionAction to be similar if that helps
(discriminator field should be called "type", yes?).
Does this make sense?
Yes if it helps)
Did you also look at John's
https://gitlab.com/jsnow/qemu/-/commits/hack-deprecate-union-branches/ ?
I hope you and John will send patches that you have, I'll help with reviewing (keep me
in CC), and finally we'll get the feature.
--
Best regards,
Vladimir