qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] a3c45b: qapi: New special feature flag "unsta


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] a3c45b: qapi: New special feature flag "unstable"
Date: Fri, 29 Oct 2021 21:44:30 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: a3c45b3e62962f99338716b1347cfb0d427cea44
      
https://github.com/qemu/qemu/commit/a3c45b3e62962f99338716b1347cfb0d427cea44
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M docs/devel/qapi-code-gen.rst
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out

  Log Message:
  -----------
  qapi: New special feature flag "unstable"

By convention, names starting with "x-" are experimental.  The parts
of external interfaces so named may be withdrawn or changed
incompatibly in future releases.

The naming convention makes unstable interfaces easy to recognize.
Promoting something from experimental to stable involves a name
change.  Client code needs to be updated.  Occasionally bothersome.

Worse, the convention is not universally observed:

* QOM type "input-barrier" has properties "x-origin", "y-origin".
  Looks accidental, but it's ABI since 4.2.

* QOM types "memory-backend-file", "memory-backend-memfd",
  "memory-backend-ram", and "memory-backend-epc" have a property
  "x-use-canonical-path-for-ramblock-id" that is documented to be
  stable despite its name.

We could document these exceptions, but documentation helps only
humans.  We want to recognize "unstable" in code, like "deprecated".

So support recognizing it the same way: introduce new special feature
flag "unstable".  It will be treated specially by the QAPI generator,
like the existing feature flag "deprecated", and unlike regular
feature flags.

This commit updates documentation and prepares tests.  The next commit
updates the QAPI schema.  The remaining patches update the QAPI
generator and wire up -compat policy checking.

Management applications can then use query-qmp-schema and -compat to
manage or guard against use of unstable interfaces the same way as for
deprecated interfaces.

docs/devel/qapi-code-gen.txt no longer mandates the naming convention.
Using it anyway might help writers of programs that aren't
full-fledged management applications.  Not using it can save us
bothersome renames.  We'll see how that shakes out.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-2-armbru@redhat.com>


  Commit: 9fb49daabfb0052f05981e5a484cd0d3bf283fc6
      
https://github.com/qemu/qemu/commit/9fb49daabfb0052f05981e5a484cd0d3bf283fc6
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M qapi/block-core.json
    M qapi/migration.json
    M qapi/misc.json
    M qapi/qom.json

  Log Message:
  -----------
  qapi: Mark unstable QMP parts with feature 'unstable'

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@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-3-armbru@redhat.com>


  Commit: 9bafe07bc8b00ce9ba5ea6f4c590239c579d83ee
      
https://github.com/qemu/qemu/commit/9bafe07bc8b00ce9ba5ea6f4c590239c579d83ee
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/qmp/dispatch.h
    M monitor/misc.c
    M scripts/qapi/commands.py

  Log Message:
  -----------
  qapi: Eliminate QCO_NO_OPTIONS for a slight simplification

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-4-armbru@redhat.com>


  Commit: c67db1ed16ff5a7c1b186caa754e0c738aa945b8
      
https://github.com/qemu/qemu/commit/c67db1ed16ff5a7c1b186caa754e0c738aa945b8
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/util.h
    M scripts/qapi/gen.py
    M scripts/qapi/schema.py

  Log Message:
  -----------
  qapi: Tools for sets of special feature flags in generated code

New enum QapiSpecialFeature enumerates the special feature flags.

New helper gen_special_features() returns code to represent a
collection of special feature flags as a bitset.

The next few commits will put them to use.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-5-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  Commit: a130728554d0cc19ef0ed4c1c824305c1682e64b
      
https://github.com/qemu/qemu/commit/a130728554d0cc19ef0ed4c1c824305c1682e64b
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M qapi/qapi-forward-visitor.c
    M qapi/qapi-visit-core.c
    M qapi/qobject-input-visitor.c
    M qapi/qobject-output-visitor.c
    M qapi/trace-events
    M scripts/qapi/visit.py

  Log Message:
  -----------
  qapi: Generalize struct member policy checking

The generated visitor functions call visit_deprecated_accept() and
visit_deprecated() when visiting a struct member with special feature
flag 'deprecated'.  This makes the feature flag visible to the actual
visitors.  I want to make feature flag 'unstable' visible there as
well, so I can add policy for it.

To let me make it visible, replace these functions by
visit_policy_reject() and visit_policy_skip(), which take the member's
special features as an argument.  Note that the new functions have the
opposite sense, i.e. the return value flips.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20211028102520.747396-6-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[Unbreak forward visitor]


  Commit: 6604e4757a1fc5832f87b5f9244efccabb49be8e
      
https://github.com/qemu/qemu/commit/6604e4757a1fc5832f87b5f9244efccabb49be8e
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/qmp/dispatch.h
    M monitor/misc.c
    M qapi/qmp-dispatch.c
    M qapi/qmp-registry.c
    M scripts/qapi/commands.py
    M storage-daemon/qemu-storage-daemon.c

  Log Message:
  -----------
  qapi: Generalize command policy checking

The code to check command policy can see special feature flag
'deprecated' as command flag QCO_DEPRECATED.  I want to make feature
flag 'unstable' visible there as well, so I can add policy for it.

To let me make it visible, add member @special_features (a bitset of
QapiSpecialFeature) to QmpCommand, and adjust the generator to pass it
through qmp_register_command().  Then replace "QCO_DEPRECATED in
@flags" by QAPI_DEPRECATED in @special_features", and drop
QCO_DEPRECATED.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-7-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>


  Commit: c8688760437aaf4bfa9012ff5aef8ab1c92a38e1
      
https://github.com/qemu/qemu/commit/c8688760437aaf4bfa9012ff5aef8ab1c92a38e1
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/util.h
    M qapi/qapi-visit-core.c
    M scripts/qapi/types.py

  Log Message:
  -----------
  qapi: Generalize enum member policy checking

The code to check enumeration value policy can see special feature
flag 'deprecated' in QEnumLookup member flags[value].  I want to make
feature flag 'unstable' visible there as well, so I can add policy for
it.

Instead of extending flags[], replace it by @special_features (a
bitset of QapiSpecialFeature), because that's how special features get
passed around elsewhere.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-8-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  Commit: 7ce5fc63c75d0ac756fd0b4d0472774de17f8fec
      
https://github.com/qemu/qemu/commit/7ce5fc63c75d0ac756fd0b4d0472774de17f8fec
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/compat-policy.h
    M qapi/qapi-util.c
    M qapi/qapi-visit-core.c
    M qapi/qmp-dispatch.c
    M qapi/qobject-input-visitor.c

  Log Message:
  -----------
  qapi: Factor out compat_policy_input_ok()

The code to check policy for handling deprecated input is triplicated.
Factor it out into compat_policy_input_ok() before I mess with it in
the next commit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211028102520.747396-9-armbru@redhat.com>
[Policy code moved from qmp-dispatch.c to qapi-util.c to make visitors
link without qmp-dispatch.o]


  Commit: 57df0dff1a1f4c846aa74a082bfd595a8a990015
      
https://github.com/qemu/qemu/commit/57df0dff1a1f4c846aa74a082bfd595a8a990015
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M include/qapi/util.h
    M qapi/compat.json
    M qapi/qapi-util.c
    M qapi/qobject-output-visitor.c
    M qemu-options.hx
    M scripts/qapi/events.py
    M scripts/qapi/schema.py

  Log Message:
  -----------
  qapi: Extend -compat to set policy for unstable interfaces

New option parameters unstable-input and unstable-output set policy
for unstable interfaces just like deprecated-input and
deprecated-output set policy for deprecated interfaces (see commit
6dd75472d5 "qemu-options: New -compat to set policy for deprecated
interfaces").  This is intended for testing users of the management
interfaces.  It is experimental.

For now, this covers only syntactic aspects of QMP, i.e. stuff tagged
with feature 'unstable'.  We may want to extend it to cover semantic
aspects, or the command line.

Note that there is no good way for management application to detect
presence of these new option parameters: they are not visible output
of query-qmp-schema or query-command-line-options.  Tolerable, because
it's meant for testing.  If running with -compat fails, skip the test.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-10-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Doc comments fixed up]


  Commit: dd61b91c080cdfba1360a5ea1e4693fffb3445b0
      
https://github.com/qemu/qemu/commit/dd61b91c080cdfba1360a5ea1e4693fffb3445b0
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M docs/devel/qapi-code-gen.rst
    M include/qapi/compat-policy.h
    M include/qapi/qmp/dispatch.h
    M include/qapi/util.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M monitor/misc.c
    M qapi/block-core.json
    M qapi/compat.json
    M qapi/migration.json
    M qapi/misc.json
    M qapi/qapi-forward-visitor.c
    M qapi/qapi-util.c
    M qapi/qapi-visit-core.c
    M qapi/qmp-dispatch.c
    M qapi/qmp-registry.c
    M qapi/qobject-input-visitor.c
    M qapi/qobject-output-visitor.c
    M qapi/qom.json
    M qapi/trace-events
    M qemu-options.hx
    M scripts/qapi/commands.py
    M scripts/qapi/events.py
    M scripts/qapi/gen.py
    M scripts/qapi/schema.py
    M scripts/qapi/types.py
    M scripts/qapi/visit.py
    M storage-daemon/qemu-storage-daemon.c
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-10-29' into 
staging

QAPI patches patches for 2021-10-29

# gpg: Signature made Fri 29 Oct 2021 12:28:53 PM PDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]

* remotes/armbru/tags/pull-qapi-2021-10-29:
  qapi: Extend -compat to set policy for unstable interfaces
  qapi: Factor out compat_policy_input_ok()
  qapi: Generalize enum member policy checking
  qapi: Generalize command policy checking
  qapi: Generalize struct member policy checking
  qapi: Tools for sets of special feature flags in generated code
  qapi: Eliminate QCO_NO_OPTIONS for a slight simplification
  qapi: Mark unstable QMP parts with feature 'unstable'
  qapi: New special feature flag "unstable"

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/a856cce31b48...dd61b91c080c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]