qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.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,
	pkrempa@redhat.com, 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, 15 Sep 2021 21:25:58 +0200	[thread overview]
Message-ID: <87mtod1vzt.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <874ke7s46i.fsf@dusky.pond.sub.org> (Markus Armbruster's message of "Wed, 09 Jun 2021 12:49:57 +0200")

Markus Armbruster <armbru@redhat.com> writes:

> 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.

Just sent:

Subject: [PATCH RFC 0/5] Subject: [PATCH RFC 0/5] qapi: Add feature flags to enum members
Message-Id: <20210915192425.4104210-1-armbru@redhat.com>

Yes, I mangled the subject %-/



      parent reply	other threads:[~2021-09-15 19:32 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
2021-07-05 19:12         ` Vladimir Sementsov-Ogievskiy
2021-09-15 19:25         ` Markus Armbruster [this message]

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=87mtod1vzt.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).