[PATCH v2 0/5] qapi: Add feature flags to enum members

Markus Armbruster posted 5 patches 2 years, 6 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
docs/devel/qapi-code-gen.rst                  | 10 ++++---
qapi/compat.json                              |  3 +++
qapi/introspect.json                          | 24 +++++++++++++++--
qapi/transaction.json                         |  5 +++-
include/qapi/qobject-input-visitor.h          |  4 ---
include/qapi/qobject-output-visitor.h         |  4 ---
include/qapi/util.h                           |  6 ++++-
include/qapi/visitor-impl.h                   |  3 +++
include/qapi/visitor.h                        |  9 +++++++
qapi/qapi-visit-core.c                        | 27 ++++++++++++++++---
qapi/qmp-dispatch.c                           |  4 +--
qapi/qobject-input-visitor.c                  | 14 +---------
qapi/qobject-output-visitor.c                 | 14 +---------
scripts/qapi/expr.py                          |  3 ++-
scripts/qapi/introspect.py                    | 19 ++++++++++---
scripts/qapi/schema.py                        | 22 +++++++++++++--
scripts/qapi/types.py                         | 17 +++++++++++-
tests/qapi-schema/doc-good.json               |  5 +++-
tests/qapi-schema/doc-good.out                |  3 +++
tests/qapi-schema/doc-good.txt                |  3 +++
.../qapi-schema/enum-dict-member-unknown.err  |  2 +-
tests/qapi-schema/qapi-schema-test.json       |  3 ++-
tests/qapi-schema/qapi-schema-test.out        |  1 +
tests/qapi-schema/test-qapi.py                |  1 +
24 files changed, 149 insertions(+), 57 deletions(-)
[PATCH v2 0/5] qapi: Add feature flags to enum members
Posted by Markus Armbruster 2 years, 6 months ago
PATCH 1+2 add feature flags to enum members.  Awkward due to an
introspection design mistake; see PATCH 1 for details.

PATCH 3+4 implement policy deprecated-input={reject,crash} for enum
values.

Policy deprecated-output=hide is not implemented, because we can't
hide a value without hiding the entire member, which is almost
certainly more than the requester of this policy bargained for.
Perhaps we want a new policy deprecated-output=hide-or-else-crash to
help us catch unwanted use of deprecated enum values.  Perhaps we want
deprecated-output=hide to behave that way together with
deprecated-input=crash.  Or even always.  Thoughts?

PATCH 5 puts the new feature flags to use.  It's RFC because it makes
sense only on top of Vladimir's deprecation of drive-backup.  See its
commit message for a reference.

I prefer to commit new features together with a use outside tests/.
PATCH 5 adds such a use, but it's RFC, because it depends on
Vladimir's work.  Perhaps another use pops up.  I can delay this work
in the hope of a use becoming ready, but the feature flags work I have
in the pipeline will eventually force my hand.

v2:
* Rebased with straightforward conflicts.
* PATCH 1-4: No longer RFC.
* PATCH 1: "Since" information fixed [Eric].  Commit message updated
  to reflect feedback.
* PATCH 2: Commit message amended to point out special feature flag
 'deprecated' is ignored at this stage.
* PATCH 4: Documentation updated.  Commit message tweaked.

Markus Armbruster (5):
  qapi: Enable enum member introspection to show more than name
  qapi: Add feature flags to enum members
  qapi: Move compat policy from QObject to generic visitor
  qapi: Implement deprecated-input={reject,crash} for enum values
  block: Deprecate transaction type drive-backup

 docs/devel/qapi-code-gen.rst                  | 10 ++++---
 qapi/compat.json                              |  3 +++
 qapi/introspect.json                          | 24 +++++++++++++++--
 qapi/transaction.json                         |  5 +++-
 include/qapi/qobject-input-visitor.h          |  4 ---
 include/qapi/qobject-output-visitor.h         |  4 ---
 include/qapi/util.h                           |  6 ++++-
 include/qapi/visitor-impl.h                   |  3 +++
 include/qapi/visitor.h                        |  9 +++++++
 qapi/qapi-visit-core.c                        | 27 ++++++++++++++++---
 qapi/qmp-dispatch.c                           |  4 +--
 qapi/qobject-input-visitor.c                  | 14 +---------
 qapi/qobject-output-visitor.c                 | 14 +---------
 scripts/qapi/expr.py                          |  3 ++-
 scripts/qapi/introspect.py                    | 19 ++++++++++---
 scripts/qapi/schema.py                        | 22 +++++++++++++--
 scripts/qapi/types.py                         | 17 +++++++++++-
 tests/qapi-schema/doc-good.json               |  5 +++-
 tests/qapi-schema/doc-good.out                |  3 +++
 tests/qapi-schema/doc-good.txt                |  3 +++
 .../qapi-schema/enum-dict-member-unknown.err  |  2 +-
 tests/qapi-schema/qapi-schema-test.json       |  3 ++-
 tests/qapi-schema/qapi-schema-test.out        |  1 +
 tests/qapi-schema/test-qapi.py                |  1 +
 24 files changed, 149 insertions(+), 57 deletions(-)

-- 
2.31.1

Re: [PATCH v2 0/5] qapi: Add feature flags to enum members
Posted by Peter Krempa 2 years, 6 months ago
On Sat, Oct 09, 2021 at 14:09:39 +0200, Markus Armbruster wrote:

I've tested this with my libvirt patches which make use of the new way
enum members are returned as well as code which validates whether
libvirt uses deprecated values and everything works as expected, thus

Series:

Tested-by: Peter Krempa <pkrempa@redhat.com>

> Markus Armbruster (5):
>   qapi: Enable enum member introspection to show more than name
>   qapi: Add feature flags to enum members
>   qapi: Move compat policy from QObject to generic visitor
>   qapi: Implement deprecated-input={reject,crash} for enum values
>   block: Deprecate transaction type drive-backup

In addition, libvirt never used 'drive-backup' so an additional

ACKed-by: Peter Krempa <pkrempa@redhat.com>

for the last patch.