From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: pkrempa@redhat.com, berrange@redhat.com, qemu-block@nongnu.org,
kchamart@redhat.com, libvir-list@redhat.com, jsnow@redhat.com,
xiechanglong.d@gmail.com, qemu-devel@nongnu.org,
yur@virtuozzo.com, nshirokovskiy@virtuozzo.com,
wencongyang2@huawei.com, den@openvz.org, eblake@redhat.com,
dim@virtuozzo.com
Subject: Re: [PATCH v2 3/3] qapi: deprecate drive-backup
Date: Wed, 09 Jun 2021 12:49:57 +0200 [thread overview]
Message-ID: <874ke7s46i.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <3c1c05c3-87ec-c665-00ae-0c0ca312e5bc@virtuozzo.com> (Vladimir Sementsov-Ogievskiy's message of "Tue, 8 Jun 2021 14:46:49 +0300")
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:
> 08.06.2021 14:12, Markus Armbruster wrote:
>> Vladimir Sementsov-Ogievskiy <vsementsov@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?).
From docs/devel/qapi-code-gen.txt:
A simple union can always be re-written as a flat union where the base
class has a single member named 'type', and where each branch of the
union has a struct with a single member named 'data'. That is,
{ 'union': 'Simple', 'data': { 'one': 'str', 'two': 'int' } }
is identical on the wire to:
{ 'enum': 'Enum', 'data': ['one', 'two'] }
{ 'struct': 'Branch1', 'data': { 'data': 'str' } }
{ 'struct': 'Branch2', 'data': { 'data': 'int' } }
{ 'union': 'Flat', 'base': { 'type': 'Enum' }, 'discriminator': 'type',
'data': { 'one': 'Branch1', 'two': 'Branch2' } }
The generated C isn't identical, but adjusting the code using it should
be straightforward.
>> 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/ ?
Not yet.
> 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.
Sounds like a plan. I need to get my post-vacation e-mail pileup under
control first.
next prev parent reply other threads:[~2021-06-09 10:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 13:58 [PATCH v2 0/3] qapi & doc: deprecate drive-backup Vladimir Sementsov-Ogievskiy
2021-05-05 13:58 ` [PATCH v2 1/3] docs/block-replication: use blockdev-backup Vladimir Sementsov-Ogievskiy
2021-05-14 20:23 ` John Snow
2021-05-05 13:58 ` [PATCH v2 2/3] docs/interop/bitmaps: " Vladimir Sementsov-Ogievskiy
2021-05-06 9:34 ` Kashyap Chamarthy
2021-05-14 20:27 ` John Snow
2021-05-05 13:58 ` [PATCH v2 3/3] qapi: deprecate drive-backup Vladimir Sementsov-Ogievskiy
2021-05-06 9:57 ` Kashyap Chamarthy
2021-05-14 22:38 ` John Snow
2021-05-24 14:06 ` Vladimir Sementsov-Ogievskiy
2021-05-24 18:37 ` John Snow
2021-09-01 13:29 ` Vladimir Sementsov-Ogievskiy
2021-09-01 14:33 ` Markus Armbruster
2021-06-08 11:12 ` Markus Armbruster
2021-06-08 11:46 ` Vladimir Sementsov-Ogievskiy
2021-06-09 10:49 ` Markus Armbruster [this message]
2021-07-05 19:12 ` Vladimir Sementsov-Ogievskiy
2021-09-15 19:25 ` 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=874ke7s46i.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=den@openvz.org \
--cc=dim@virtuozzo.com \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kchamart@redhat.com \
--cc=libvir-list@redhat.com \
--cc=nshirokovskiy@virtuozzo.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.com \
--cc=yur@virtuozzo.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).