Revision tags: v8.2.3, v7.2.11, v9.0.0, v9.0.0-rc4, v9.0.0-rc3, v9.0.0-rc2, v9.0.0-rc1, v9.0.0-rc0 |
|
#
41d0ad1d |
| 16-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: Rename visitor parameter @variants to @alternatives
A previous commit narrowed the type of .visit_alternate_type() parameter @variants from QAPISchemaVariants to QAPISchemaAlternatives. Rename
qapi: Rename visitor parameter @variants to @alternatives
A previous commit narrowed the type of .visit_alternate_type() parameter @variants from QAPISchemaVariants to QAPISchemaAlternatives. Rename it to @alternatives.
One of them passes @alternatives to helper function gen_visit_alternate(). Rename its @variants parameter to @alternatives as well.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
d1da8af8 |
| 15-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: Rename visitor parameter @variants to @branches
The previous commit narrowed the type of .visit_object_type() parameter @variants from QAPISchemaVariants to QAPISchemaBranches. Rename it to @b
qapi: Rename visitor parameter @variants to @branches
The previous commit narrowed the type of .visit_object_type() parameter @variants from QAPISchemaVariants to QAPISchemaBranches. Rename it to @branches.
Same for .visit_object_type_flat().
A few of these pass @branches to helper functions: QAPISchemaGenRSTVisitor.visit_object_type() to ._nodes_for_members() and ._nodes_for_variant_when(), and QAPISchemaGenVisitVisitor.visit_object_type() to gen_visit_object_members(). Rename the helpers' @variants parameters to @branches as well.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
1d067e39 |
| 15-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: New QAPISchemaBranches, QAPISchemaAlternatives
QAPISchemaVariants represents either a union type's branches, or an alternate type's alternatives. Much of its code is conditional on which one
qapi: New QAPISchemaBranches, QAPISchemaAlternatives
QAPISchemaVariants represents either a union type's branches, or an alternate type's alternatives. Much of its code is conditional on which one it actually is.
Create QAPISchemaBranches for branches, and QAPISchemaAlternatives for alternatives, both subtypes of QAPISchemaVariants.
Replace QAPISchemaVariants by one of them where possible. Keep it only where we actually deal with either of them.
QAPISchemaVariants.__init__() takes @tag_name and @tag_member, where exactly one must be None: @tag_name for alternatives, @tag_member for branches. Let QAPISchemaBranches.__init__() take just @tag_name, and QAPISchemaAlternatives.__init__() take just @tag_member.
A later patch will move the conditional code to the subtypes.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v8.2.3, v7.2.11, v9.0.0, v9.0.0-rc4, v9.0.0-rc3, v9.0.0-rc2, v9.0.0-rc1, v9.0.0-rc0 |
|
#
41d0ad1d |
| 16-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: Rename visitor parameter @variants to @alternatives
A previous commit narrowed the type of .visit_alternate_type() parameter @variants from QAPISchemaVariants to QAPISchemaAlternatives. Rename
qapi: Rename visitor parameter @variants to @alternatives
A previous commit narrowed the type of .visit_alternate_type() parameter @variants from QAPISchemaVariants to QAPISchemaAlternatives. Rename it to @alternatives.
One of them passes @alternatives to helper function gen_visit_alternate(). Rename its @variants parameter to @alternatives as well.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
d1da8af8 |
| 15-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: Rename visitor parameter @variants to @branches
The previous commit narrowed the type of .visit_object_type() parameter @variants from QAPISchemaVariants to QAPISchemaBranches. Rename it to @b
qapi: Rename visitor parameter @variants to @branches
The previous commit narrowed the type of .visit_object_type() parameter @variants from QAPISchemaVariants to QAPISchemaBranches. Rename it to @branches.
Same for .visit_object_type_flat().
A few of these pass @branches to helper functions: QAPISchemaGenRSTVisitor.visit_object_type() to ._nodes_for_members() and ._nodes_for_variant_when(), and QAPISchemaGenVisitVisitor.visit_object_type() to gen_visit_object_members(). Rename the helpers' @variants parameters to @branches as well.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
1d067e39 |
| 15-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: New QAPISchemaBranches, QAPISchemaAlternatives
QAPISchemaVariants represents either a union type's branches, or an alternate type's alternatives. Much of its code is conditional on which one
qapi: New QAPISchemaBranches, QAPISchemaAlternatives
QAPISchemaVariants represents either a union type's branches, or an alternate type's alternatives. Much of its code is conditional on which one it actually is.
Create QAPISchemaBranches for branches, and QAPISchemaAlternatives for alternatives, both subtypes of QAPISchemaVariants.
Replace QAPISchemaVariants by one of them where possible. Keep it only where we actually deal with either of them.
QAPISchemaVariants.__init__() takes @tag_name and @tag_member, where exactly one must be None: @tag_name for alternatives, @tag_member for branches. Let QAPISchemaBranches.__init__() take just @tag_name, and QAPISchemaAlternatives.__init__() take just @tag_member.
A later patch will move the conditional code to the subtypes.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
7191400a |
| 15-Mar-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: Assert built-in types exist
QAPISchema.lookup_type('FOO') returns a QAPISchemaType when type 'FOO' exists, else None. It won't return None for built-in types like 'int'.
Since mypy can't see
qapi: Assert built-in types exist
QAPISchema.lookup_type('FOO') returns a QAPISchemaType when type 'FOO' exists, else None. It won't return None for built-in types like 'int'.
Since mypy can't see that, it'll complain that we assign the Optional[QAPISchemaType] returned by .lookup_type() to QAPISchemaType variables.
Add assertions to help it over the hump.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240315152301.3621858-13-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
show more ...
|
Revision tags: v8.2.2, v7.2.10, v8.2.1, v8.1.5, v7.2.9, v8.1.4, v7.2.8, v8.2.0, v8.2.0-rc4, v8.2.0-rc3, v8.2.0-rc2, v8.2.0-rc1, v7.2.7, v8.1.3, v8.2.0-rc0, v8.1.2, v8.1.1, v7.2.6, v8.0.5, v8.1.0, v8.1.0-rc4, v8.1.0-rc3, v7.2.5, v8.0.4, v8.1.0-rc2, v8.1.0-rc1, v8.1.0-rc0, v8.0.3, v7.2.4, v8.0.2, v8.0.1, v7.2.3, v7.2.2, v8.0.0, v8.0.0-rc4, v8.0.0-rc3, v7.2.1, v8.0.0-rc2, v8.0.0-rc1, v8.0.0-rc0, v7.2.0, v7.2.0-rc4, v7.2.0-rc3, v7.2.0-rc2, v7.2.0-rc1, v7.2.0-rc0, v7.1.0, v7.1.0-rc4, v7.1.0-rc3, v7.1.0-rc2, v7.1.0-rc1, v7.1.0-rc0, v7.0.0, v7.0.0-rc4, v7.0.0-rc3, v7.0.0-rc2, v7.0.0-rc1, v7.0.0-rc0, v6.1.1, v6.2.0, v6.2.0-rc4, v6.2.0-rc3, v6.2.0-rc2, v6.2.0-rc1, v6.2.0-rc0, v6.0.1 |
|
#
b6c18755 |
| 25-Oct-2021 |
Markus Armbruster <armbru@redhat.com> |
qapi: Add feature flags to enum members
This is quite similar to commit 84ab008687 "qapi: Add feature flags to struct members", only for enums instead of structs.
Special feature flag 'deprecated'
qapi: Add feature flags to enum members
This is quite similar to commit 84ab008687 "qapi: Add feature flags to struct members", only for enums instead of structs.
Special feature flag 'deprecated' is silently ignored there. This is okay only because it will be implemented shortly.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20211025042405.3762351-3-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
show more ...
|
#
75ecee72 |
| 25-Oct-2021 |
Markus Armbruster <armbru@redhat.com> |
qapi: Enable enum member introspection to show more than name
The next commit will add feature flags to enum members. There's a problem, though: query-qmp-schema shows an enum type's members as an
qapi: Enable enum member introspection to show more than name
The next commit will add feature flags to enum members. There's a problem, though: query-qmp-schema shows an enum type's members as an array of member names (SchemaInfoEnum member @values). If it showed an array of objects with a name member, we could simply add more members to these objects. Since it's just strings, we can't.
I can see three ways to correct this design mistake:
1. Do it the way we should have done it, plus compatibility goo.
We want a ['SchemaInfoEnumMember'] member in SchemaInfoEnum. Since changing @values would be a compatibility break, add a new member @members instead.
@values is now redundant. In my testing, output of qemu-system-x86_64's query-qmp-schema grows by 11% (18.5KiB).
We can deprecate @values now and drop it later. This will break outmoded clients. Well-behaved clients such as libvirt are expected to break cleanly.
2. Like 1, but omit "boring" elements of @member, and empty @member.
@values does not become redundant. @members augments it. Somewhat cumbersome, but output of query-qmp-schema grows only as we make enum members non-boring.
There is nothing to deprecate here.
3. Versioned query-qmp-schema.
query-qmp-schema provides either @values or @members. The QMP client can select which version it wants. There is no redundant output.
We can deprecate old versions and eventually drop them. This will break outmoded clients. Breaking cleanly is easier than for 1.
While 1 and 2 operate within the common rules for compatible evolution apply (section "Compatibility considerations" in docs/devel/qapi-code-gen.rst), 3 bypasses them. Attractive when operating within the rules is just too awkward. Not the case here.
This commit implements 1. Libvirt developers prefer it.
Deprecate @values in favour of @members. Since query-qmp-schema compatibility is pretty fundamental for management applications, an extended grace period is advised.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Peter Krempa <pkrempa@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Message-Id: <20211025042405.3762351-2-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
show more ...
|
#
1889e57a |
| 31-Aug-2021 |
Markus Armbruster <armbru@redhat.com> |
qapi: Simplify QAPISchemaIfCond's interface for generating C
QAPISchemaIfCond.cgen() is only ever used like
gen_if(ifcond.cgen())
and
gen_endif(ifcond.cgen())
Simplify to
ifcond.gen
qapi: Simplify QAPISchemaIfCond's interface for generating C
QAPISchemaIfCond.cgen() is only ever used like
gen_if(ifcond.cgen())
and
gen_endif(ifcond.cgen())
Simplify to
ifcond.gen_if()
and
ifcond.gen_endif()
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210831123809.1107782-2-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [Import statements tidied up with isort]
show more ...
|
Revision tags: v6.1.0, v6.1.0-rc4, v6.1.0-rc3, v6.1.0-rc2 |
|
#
6cc2e481 |
| 04-Aug-2021 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: introduce QAPISchemaIfCond.cgen()
Instead of building prepocessor conditions from a list of string, use the result generated from QAPISchemaIfCond.cgen() and hide the implementation details.
qapi: introduce QAPISchemaIfCond.cgen()
Instead of building prepocessor conditions from a list of string, use the result generated from QAPISchemaIfCond.cgen() and hide the implementation details.
Note: this patch introduces a minor regression, generating a redundant pair of parenthesis. This is mostly fixed in a later patch in this series ("qapi: replace if condition list with dict [..]")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-5-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
33aa3267 |
| 04-Aug-2021 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: add QAPISchemaIfCond.is_present()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210804083105.97531-4-marcandr
qapi: add QAPISchemaIfCond.is_present()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210804083105.97531-4-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
f17539c8 |
| 04-Aug-2021 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: wrap Sequence[str] in an object
Mechanical change, except for a new assertion in QAPISchemaEntity.ifcond().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <2021080
qapi: wrap Sequence[str] in an object
Mechanical change, except for a new assertion in QAPISchemaEntity.ifcond().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-3-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Rebased with obvious conflicts, commit message adjusted] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v6.1.0-rc1, v6.1.0-rc0, v6.0.0, v6.0.0-rc5, v6.0.0-rc4, v6.0.0-rc3, v6.0.0-rc2, v6.0.0-rc1, v6.0.0-rc0 |
|
#
9b77d946 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: set _gen_tree's default ifcond argument to ()
We don't need to create an empty, mutable list to pass to _gen_tree; since it is now typed as a Sequence, we can use the empty tuple
qapi/introspect.py: set _gen_tree's default ifcond argument to ()
We don't need to create an empty, mutable list to pass to _gen_tree; since it is now typed as a Sequence, we can use the empty tuple as a default and omit the argument.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-19-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
cea53c31 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: Type _gen_tree variants as Sequence[str]
Optional[List] is clunky; an empty sequence can more elegantly convey "no variants". By downgrading "List" to "Sequence", we can also acc
qapi/introspect.py: Type _gen_tree variants as Sequence[str]
Optional[List] is clunky; an empty sequence can more elegantly convey "no variants". By downgrading "List" to "Sequence", we can also accept tuples; this is useful for the empty tuple specifically, which we may use as a default parameter because it is immutable.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-18-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Doc string touched up] Reviewed-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
cf26906c |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: Update copyright and authors list
To reflect the work that went into strictly typing introspect.py, punish myself by claiming credit.
Signed-off-by: John Snow <jsnow@redhat.com>
qapi/introspect.py: Update copyright and authors list
To reflect the work that went into strictly typing introspect.py, punish myself by claiming credit.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-17-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
5444dedf |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: Add docstrings to _gen_tree and _tree_to_qlit
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-16-jsnow@redhat.com> Reviewed-by: Markus Armbruster <
qapi/introspect.py: Add docstrings to _gen_tree and _tree_to_qlit
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-16-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Doc string improvements squashed in] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
82b52f6b |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: add type hint annotations
NB: The type aliases (SchemaInfo et al) declare intent for some of the "dictly-typed" objects we pass around in introspect.py. They do not enforce the s
qapi/introspect.py: add type hint annotations
NB: The type aliases (SchemaInfo et al) declare intent for some of the "dictly-typed" objects we pass around in introspect.py. They do not enforce the shape of those objects, and cannot, until Python 3.7 or later. (And even then, it may not be "worth it".)
Annotations are also added to the QAPISchemaEntity __init__ method in schema.py to allow mypy to statically prove the type of typ.name, needed to prove the return type of QAPISchemaGenIntrospectVisitor._use_type().
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-15-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Note on QAPISchemaEntity.__init__() squashed into commit message, Comment wrapped to conform to PEP 8] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
cf5db214 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: remove _gen_variants helper
It is easier to give a name to all of the dictly-typed objects we pass around in introspect.py by removing this helper, as it does not return an objec
qapi/introspect.py: remove _gen_variants helper
It is easier to give a name to all of the dictly-typed objects we pass around in introspect.py by removing this helper, as it does not return an object that has any knowable type by itself.
Inline it into its only caller instead.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-14-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
c0e8d9f3 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: improve readability of _tree_to_qlit
Subjective, but I find getting rid of the comprehensions helps. Also, divide the sections into scalar and non-scalar sections, and remove old
qapi/introspect.py: improve readability of _tree_to_qlit
Subjective, but I find getting rid of the comprehensions helps. Also, divide the sections into scalar and non-scalar sections, and remove old-style string formatting.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-13-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
2a6c161b |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: improve _tree_to_qlit error message
Trivial; make the error message just a pinch more explicit in case we trip this by accident in the future.
Signed-off-by: John Snow <jsnow@re
qapi/introspect.py: improve _tree_to_qlit error message
Trivial; make the error message just a pinch more explicit in case we trip this by accident in the future.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-12-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
4f7f97a7 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: create a typed 'Annotated' data strutcure
Presently, we use a tuple to attach a dict containing annotations (comments and compile-time conditionals) to a tree node. This is undes
qapi/introspect.py: create a typed 'Annotated' data strutcure
Presently, we use a tuple to attach a dict containing annotations (comments and compile-time conditionals) to a tree node. This is undesirable because dicts are difficult to strongly type; promoting it to a real class allows us to name the values and types of the annotations we are expecting.
In terms of typing, the Annotated<T> type serves as a generic container where the annotated node's type is preserved, allowing for greater specificity than we'd be able to provide without a generic.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-11-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
9db27346 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: Introduce preliminary tree typing
The types will be used in forthcoming patches to add typing. These types describe the layout and structure of the objects passed to _tree_to_qli
qapi/introspect.py: Introduce preliminary tree typing
The types will be used in forthcoming patches to add typing. These types describe the layout and structure of the objects passed to _tree_to_qlit, but lack the power to describe annotations until the next commit.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-10-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
d4c5b429 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: Always define all 'extra' dict keys
This mimics how a typed object works, where 'if' and 'comment' are always set, regardless of if they have a value set or not.
It is safe to d
qapi/introspect.py: Always define all 'extra' dict keys
This mimics how a typed object works, where 'if' and 'comment' are always set, regardless of if they have a value set or not.
It is safe to do this because of the way that _tree_to_qlit processes these values (using dict.get with a default of None), resulting in no change of output from _tree_to_qlit. There are no other users of this data.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-9-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
5f50cede |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: replace 'extra' dict with 'comment' argument
This is only used to pass in a dictionary with a comment already set, so skip the runaround and just accept the (optional) comment.
qapi/introspect.py: replace 'extra' dict with 'comment' argument
This is only used to pass in a dictionary with a comment already set, so skip the runaround and just accept the (optional) comment.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-8-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|