[PATCH 2/9] qapi: Mark unstable QMP parts with feature 'unstable'

Markus Armbruster armbru at redhat.com
Wed Oct 27 05:44:24 UTC 2021


John Snow <jsnow at redhat.com> writes:

> On Tue, Oct 26, 2021 at 3:56 AM Markus Armbruster <armbru at redhat.com> wrote:
>
>> John Snow <jsnow at redhat.com> writes:
>>
>> > On Mon, Oct 25, 2021 at 1:25 AM Markus Armbruster <armbru at redhat.com>
>> wrote:
>> >
>> >> Add special feature 'unstable' everywhere the name starts with 'x-',
>> >> except for InputBarrierProperties member x-origin and
>> >> MemoryBackendProperties member x-use-canonical-path-for-ramblock-id,
>> >> because these two are actually stable.
>> >>
>> >> Signed-off-by: Markus Armbruster <armbru at redhat.com>
>> >> ---
>> >>  qapi/block-core.json | 123 +++++++++++++++++++++++++++++++------------
>> >>  qapi/migration.json  |  35 +++++++++---
>> >>  qapi/misc.json       |   6 ++-
>> >>  qapi/qom.json        |  11 ++--
>> >>  4 files changed, 130 insertions(+), 45 deletions(-)
>> >>
>> >> diff --git a/qapi/block-core.json b/qapi/block-core.json
>> >> index 6d3217abb6..ce2c1352cb 100644
>> >> --- a/qapi/block-core.json
>> >> +++ b/qapi/block-core.json
>> >> @@ -1438,6 +1438,9 @@
>> >>  #
>> >>  # @x-perf: Performance options. (Since 6.0)
>> >>  #
>> >> +# Features:
>> >> +# @unstable: Member @x-perf is experimental.
>> >> +#
>> >>
>> >
>> > It'd be a lot cooler if we could annotate the unstable member directly
>> > instead of confusing it with the syntax that might describe the entire
>> > struct/union/command/etc, but ... eh, it's just a doc field, so I'm not
>> > gonna press on this. I don't have the energy to get into a doc formatting
>> > standard discussion right now, so: sure, why not?
>>
>> By design, we have a single doc comment block for the entire definition.
>>
>> When Kevin invented feature flags (merge commit 4747524f9f2), he added
>> them just to struct types.  He added "feature sections" for documenting
>> features.  It mirrors the "argument sections" for documenting members.
>> Makes sense.
>>
>> Aside: he neglected to update qapi-code-gen.rst section "Definition
>> documentation", and I failed to catch it.  I'll make up for it.
>>
>> Peter and I then added feature flags to the remaining definitions
>> (commit 23394b4c39 and 013b4efc9b).  Feature sections make sense there,
>> too.
>>
>> I then added them to struct members (commit 84ab008687).  Instead of
>> doing something fancy for documenting feature flags of members, I simply
>> used the existing feature sections.  This conflates member features with
>> struct features.
>>
>>
> Yeah, that's the part I don't like. If this isn't the first instance of
> breaking the seal, though, this is the wrong time for me to comment on it.
> Don't worry about it for this series.

Okay.

>> What could "something fancy" be?  All we have for members is "argument
>> sections", which are basically a name plus descriptive text.  We'd have
>> to add structure to that, say nest feature sections into argument
>> sections.  I have no appetite for that right now.
>>
>>
> (Tangent below, unrelated to acceptance of this series)
>
> Yeah, I don't have an appetite for it at the moment either. I'll have to
> read Marc-Andre's recent sphinx patches and see if I want to do more work
> -- I had a bigger prototype a few months back I didn't bring all the way
> home, but I am still thinking about reworking our QAPIDoc format. It's ...
> well. I don't really want to, but I am not sure how else to bring some of
> the features I want home, and I think I need some more time to think
> carefully through exactly what I want to do and why.
>
> I wouldn't mind chatting about it with you sometime soon -- there's a few
> things to balance here, such as:
>
> (1) Reworking the doc format would be an obnoxious amount of churn, ...

Yes.  But that need not be the end of the argument, it may be the
beginning of one.

> (2) ...but the Sphinx internals are really not meant to be used the way
> we're using them right now, ...

Happy to trust you on this one.

> (3) ...but I also don't want to write our QAPI docstrings in a way that
> *targets* Sphinx. Not that I think we'll be dropping it any time soon, but
> it still feels like the wrong idea to tie them so closely together.

Maybe.  Depends on what we get for it.

> I'm hoping there's an opportunity to make the parsing nicer with minimal
> changes to the parsing and format, though. It just might require enforcing
> a *pinch* more structure. I could see how I feel about per-field
> annotations at that point.

The doc comment language is the result of a series of pragmatic
decisions that got us from semi-accidental comment conventions to where
we are now.  Each of the decisions made sense at the time.  The result
is messy to describe and to parse.  It's limiting and hard to grow
further.

>                            I consider them interesting for things like the
> Python SDK where I may want to enable/disable warnings for using deprecated
> stuff at the client-level. (e.g., let's say you're using Python SDK 6.2 to
> talk to a 6.1 client. Nothing stops you from doing this, but some commands
> will simply be rejected by QEMU as it won't know what you're talking about.
> Using deprecated fields or commands to talk to an older client will produce
> no visible warning from QEMU either, as it wasn't deprecated at that point
> in time. Still, the client may wish to know that they're asking for future
> trouble -- so it's a thought that client-side warnings have some play here.)
>
> Ehhhhhhhhhhhhhhhh don't worry about it for now, I guess I'll plow forward a
> bit with the Sphinx stuff I'm thinking of at some point Soon:tm: and worry
> about where the immovable objects are when I get there. This is foot-based
> landmine-detection, and it works 100% of the time.

Soldier, hand me the binoculars before you enter the minefield.  Good
luck!

Back to serious: I feel we need to wrap the typing hints work before we
start the next big QAPI schema language project.

>> >>  # Note: @on-source-error and @on-target-error only affect background
>> >>  #       I/O.  If an error occurs during a guest write request, the
>> >> device's
>> >>  #       rerror/werror actions will be used.
>> >> @@ -1452,7 +1455,9 @@
>> >>              '*on-source-error': 'BlockdevOnError',
>> >>              '*on-target-error': 'BlockdevOnError',
>> >>              '*auto-finalize': 'bool', '*auto-dismiss': 'bool',
>> >> -            '*filter-node-name': 'str', '*x-perf': 'BackupPerf'  } }
>> >> +            '*filter-node-name': 'str',
>> >> +            '*x-perf': { 'type': 'BackupPerf',
>> >> +                         'features': [ 'unstable' ] } } }
>> >>
>> >>  ##
>> >>  # @DriveBackup:
>>
>> [...]
>>
>> > Seems OK, but I didn't audit for false positives/negatives. Trusting your
>> > judgment here. (It looks like Phil started to audit this in his reply to
>> > your previous commit, so I'll trust that.)
>>
>> I'm pretty sure the x- names that don't get feature 'unstable' are
>> actually stable; see my reply to Kashyap.
>>
>> I did check git history for each that does get feature 'unstable'.
>> Double-checking is of course welcome.
>>
>>
> Yeh, just explaining why it's not an R-B. I'm trying to be a bit better
> about reviews by not forcing myself to do "all or nothing". I trust your
> work, of course -- I just also did not double check it :)

You stating the limits of your review is useful.

Me stating the limits of my own research is also useful :)

> I need to change the way in which I read and discuss code so that I can be
> more responsive.
>
>
>> > Acked-by: John Snow <jsnow at redhat.com>
>>
>> Thanks!
>>
>>




More information about the libvir-list mailing list