#
84cf0991 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: Unify return type of _make_tree()
Returning two different types conditionally can be complicated to type. Return one type for consistency.
Signed-off-by: John Snow <jsnow@redhat
qapi/introspect.py: Unify return type of _make_tree()
Returning two different types conditionally can be complicated to type. Return one type for consistency.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-7-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
05556960 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: guard against ifcond/comment misuse
_tree_to_qlit is called recursively on dict values (isolated from their keys); at such a point in generating output it is too late to apply an
qapi/introspect.py: guard against ifcond/comment misuse
_tree_to_qlit is called recursively on dict values (isolated from their keys); at such a point in generating output it is too late to apply an ifcond. Similarly, comments do not necessarily have a "tidy" place they can be printed in such a circumstance.
Forbid this usage by renaming "suppress_first_indent" to "dict_value" to emphasize that indents are suppressed only for the benefit of dict values; then add an assertion assuring we do not pass ifcond/comments in this case.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-6-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Comment wrapped to conform to PEP 8] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
84bece7d |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: add _gen_features helper
_make_tree might receive a dict (a SchemaInfo object) or some other type (usually, a string) for its obj parameter. Adding features information should ar
qapi/introspect.py: add _gen_features helper
_make_tree might receive a dict (a SchemaInfo object) or some other type (usually, a string) for its obj parameter. Adding features information should arguably be performed by the caller at such a time when we know the type of the object and don't have to re-interrogate it.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-5-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
d70f5130 |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: use _make_tree for features nodes
At present, we open-code this in _make_tree itself; but if the structure of the tree changes, this is brittle. Use an explicit recursive call to
qapi/introspect.py: use _make_tree for features nodes
At present, we open-code this in _make_tree itself; but if the structure of the tree changes, this is brittle. Use an explicit recursive call to _make_tree when appropriate to help keep the interior node typing consistent.
A consequence of doing this is that the 'ifcond' key of the features dict will be omitted when ifcond is false-ish, just like it is omitted in top-level calls to _make_tree. This also increases consistency in our handling of this property.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-4-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
6b67bcac |
| 16-Feb-2021 |
John Snow <jsnow@redhat.com> |
qapi/introspect.py: assert schema is not None
The introspect visitor is stateful, but expects that it will have a schema to refer to. Add assertions that state this.
Signed-off-by: John Snow <jsnow
qapi/introspect.py: assert schema is not None
The introspect visitor is stateful, but expects that it will have a schema to refer to. Add assertions that state this.
Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210216021809.134886-3-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v5.2.0, v5.2.0-rc4, v5.2.0-rc3, v5.2.0-rc2, v5.2.0-rc1, v5.2.0-rc0 |
|
#
67fea575 |
| 09-Oct-2020 |
John Snow <jsnow@redhat.com> |
qapi: enforce import order/styling with isort
While we're mucking around with imports, we might as well formalize the style we use. Let's use isort to do it for us.
lines_after_imports=2: Use two l
qapi: enforce import order/styling with isort
While we're mucking around with imports, we might as well formalize the style we use. Let's use isort to do it for us.
lines_after_imports=2: Use two lines after imports, to match PEP8's desire to have "two lines before and after" class definitions, which are likely to start immediately after imports.
force_sort_within_sections: Intermingles "from x" and "import x" style statements, such that sorting is always performed strictly on the module name itself.
force_grid_wrap=4: Four or more imports from a single module will force the one-per-line style that's more git-friendly. This will generally happen for 'typing' imports.
multi_line_output=3: Uses the one-per-line indented style for long imports.
include_trailing_comma: Adds a comma to the last import in a group, which makes git conflicts nicer to deal with, generally.
line_length: 72 is chosen to match PEP8's "docstrings and comments" line length limit. If you have a single line import that exceeds 72 characters, your names are too long!
Suggested-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201009161558.107041-8-jsnow@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
5af8263d |
| 09-Oct-2020 |
John Snow <jsnow@redhat.com> |
qapi: Remove wildcard includes
Wildcard includes become hard to manage when refactoring and dealing with circular dependencies with strictly typed mypy.
flake8 also flags each one as a warning, as
qapi: Remove wildcard includes
Wildcard includes become hard to manage when refactoring and dealing with circular dependencies with strictly typed mypy.
flake8 also flags each one as a warning, as it is not smart enough to know which names exist in the imported file.
Remove them and include things explicitly by name instead.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201009161558.107041-7-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
7137a960 |
| 09-Oct-2020 |
John Snow <jsnow@redhat.com> |
qapi: Prefer explicit relative imports
All of the QAPI include statements are changed to be package-aware, as explicit relative imports.
A quirk of Python packages is that the name of the package e
qapi: Prefer explicit relative imports
All of the QAPI include statements are changed to be package-aware, as explicit relative imports.
A quirk of Python packages is that the name of the package exists only *outside* of the package. This means that to a module inside of the qapi folder, there is inherently no such thing as the "qapi" package. The reason these imports work is because the "qapi" package exists in the context of the caller -- the execution shim, where sys.path includes a directory that has a 'qapi' folder in it.
When we write "from qapi import sibling", we are NOT referencing the folder 'qapi', but rather "any package named qapi in sys.path". If you should so happen to have a 'qapi' package in your path, it will use *that* package.
When we write "from .sibling import foo", we always reference explicitly our sibling module; guaranteeing consistency in *where* we are importing these modules from.
This can be useful when working with virtual environments and packages in development mode. In development mode, a package is installed as a series of symlinks that forwards to your same source files. The problem arises because code quality checkers will follow "import qapi.x" to the "installed" version instead of the sibling file and -- even though they are the same file -- they have different module paths, and this causes cyclic import problems, false positive type mismatch errors, and more.
It can also be useful when dealing with hierarchical packages, e.g. if we allow qemu.core.qmp, qemu.qapi.parser, etc.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201009161558.107041-6-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
04f22362 |
| 05-Oct-2020 |
Kevin Wolf <kwolf@redhat.com> |
qapi: Add a 'coroutine' flag for commands
This patch adds a new 'coroutine' flag to QMP command definitions that tells the QMP dispatcher that the command handler is safe to be run in a coroutine.
qapi: Add a 'coroutine' flag for commands
This patch adds a new 'coroutine' flag to QMP command definitions that tells the QMP dispatcher that the command handler is safe to be run in a coroutine.
The documentation of the new flag pretends that this flag is already used as intended, which it isn't yet after this patch. We'll implement this in another patch in this series.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20201005155855.256490-9-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v5.0.1, v5.1.0, v5.1.0-rc3, v5.1.0-rc2, v5.1.0-rc1, v5.1.0-rc0, v4.2.1, v5.0.0, v5.0.0-rc4, v5.0.0-rc3, v5.0.0-rc2, v5.0.0-rc1, v5.0.0-rc0 |
|
#
84ab0086 |
| 17-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi: Add feature flags to struct members
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-21-armbr
qapi: Add feature flags to struct members
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-21-armbru@redhat.com>
show more ...
|
#
24cfd6ad |
| 17-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi/introspect: Factor out _make_tree()
The value of @qmp_schema_qlit is generated from an expression tree. Tree nodes are created in several places. Factor out the common code into _make_tree().
qapi/introspect: Factor out _make_tree()
The value of @qmp_schema_qlit is generated from an expression tree. Tree nodes are created in several places. Factor out the common code into _make_tree(). This isn't much of a win now. It will pay off when we add feature flags in the next few commits.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-16-armbru@redhat.com>
show more ...
|
#
2e8a843d |
| 17-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi/introspect: Rename *qlit* to reduce confusion
We generate the value of qmp_schema_qlit from an expression tree. The function doing that is named to_qlit(), and its inputs are accumulated in QA
qapi/introspect: Rename *qlit* to reduce confusion
We generate the value of qmp_schema_qlit from an expression tree. The function doing that is named to_qlit(), and its inputs are accumulated in QAPISchemaGenIntrospectVisitor._qlits. We call both its input and its output "qlit". This is confusing.
Use "tree" for input, and "qlit" only for output: rename to_qlit() to _tree_to_qlit(), ._qlits to ._trees, ._gen_qlit() to ._gen_tree().
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-15-armbru@redhat.com>
show more ...
|
#
7b3bc9e2 |
| 17-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi: Consistently put @features parameter right after @ifcond
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Bla
qapi: Consistently put @features parameter right after @ifcond
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200317115459.31821-14-armbru@redhat.com>
show more ...
|
#
013b4efc |
| 17-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi: Add feature flags to remaining definitions
In v4.1.0, we added feature flags just to struct types (commit 6a8c0b5102^..f3ed93d545), to satisfy an immediate need (commit c9d4070991 "file-posix:
qapi: Add feature flags to remaining definitions
In v4.1.0, we added feature flags just to struct types (commit 6a8c0b5102^..f3ed93d545), to satisfy an immediate need (commit c9d4070991 "file-posix: Add dynamic-auto-read-only QAPI feature"). In v4.2.0, we added them to commands (commit 23394b4c39 "qapi: Add feature flags to commands") to satisfy another immediate need (commit d76744e65e "qapi: Allow introspecting fix for savevm's cooperation with blockdev").
Add them to the remaining definitions: enumeration types, union types, alternate types, and events.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200317115459.31821-13-armbru@redhat.com>
show more ...
|
#
8ec0e1a4 |
| 04-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi: Brush off some (py)lint
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200304155932.20452-5-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
|
#
2cae67bc |
| 04-Mar-2020 |
Markus Armbruster <armbru@redhat.com> |
qapi: Use super() now we have Python 3
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200304155932.20452-4-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
|
Revision tags: v4.2.0, v4.2.0-rc5, v4.2.0-rc4, v4.2.0-rc3, v4.2.0-rc2, v4.1.1, v4.2.0-rc1, v4.2.0-rc0 |
|
#
23394b4c |
| 18-Oct-2019 |
Peter Krempa <pkrempa@redhat.com> |
qapi: Add feature flags to commands
Similarly to features for struct types introduce the feature flags also for commands. This will allow notifying management layers of fixes and compatible changes
qapi: Add feature flags to commands
Similarly to features for struct types introduce the feature flags also for commands. This will allow notifying management layers of fixes and compatible changes in the behaviour of a command which may not be detectable any other way.
The changes were heavily inspired by commit 6a8c0b51025.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191018081454.21369-3-armbru@redhat.com>
show more ...
|
#
e6c42b96 |
| 18-Oct-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Split up scripts/qapi/common.py
The QAPI code generator clocks in at some 3100 SLOC in 8 source files. Almost 60% of the code is in qapi/common.py. Split it into more focused modules:
* Move
qapi: Split up scripts/qapi/common.py
The QAPI code generator clocks in at some 3100 SLOC in 8 source files. Almost 60% of the code is in qapi/common.py. Split it into more focused modules:
* Move QAPISchemaPragma and QAPISourceInfo to qapi/source.py.
* Move QAPIError and its sub-classes to qapi/error.py.
* Move QAPISchemaParser and QAPIDoc to parser.py. Use the opportunity to put QAPISchemaParser first.
* Move check_expr() & friends to qapi/expr.py. Use the opportunity to put the code into a more sensible order.
* Move QAPISchema & friends to qapi/schema.py
* Move QAPIGen and its sub-classes, ifcontext, QAPISchemaModularCVisitor, and QAPISchemaModularCVisitor to qapi/gen.py
* Delete camel_case(), it's unused since commit e98859a9b9 "qapi: Clean up after recent conversions to QAPISchemaVisitor"
A number of helper functions remain in qapi/common.py. I considered moving the code generator helpers to qapi/gen.py, but decided not to. Perhaps we should rewrite them as methods of QAPIGen some day.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20191018074345.24034-7-armbru@redhat.com> [Add "# -*- coding: utf-8 -*-" lines]
show more ...
|
Revision tags: v4.0.1, v3.1.1.1, v4.1.0, v4.1.0-rc5, v4.1.0-rc4, v3.1.1, v4.1.0-rc3, v4.1.0-rc2, v4.1.0-rc1, v4.1.0-rc0 |
|
#
6a8c0b51 |
| 06-Jun-2019 |
Kevin Wolf <kwolf@redhat.com> |
qapi: Add feature flags to struct types
Sometimes, the behaviour of QEMU changes without a change in the QMP syntax (usually by allowing values or operations that previously resulted in an error). Q
qapi: Add feature flags to struct types
Sometimes, the behaviour of QEMU changes without a change in the QMP syntax (usually by allowing values or operations that previously resulted in an error). QMP clients may still need to know whether they can rely on the changed behavior.
Let's add feature flags to the QAPI schema language, so that we can make such changes visible with schema introspection.
An example for a schema definition using feature flags looks like this:
{ 'struct': 'TestType', 'data': { 'number': 'int' }, 'features': [ 'allow-negative-numbers' ] }
Introspection information then looks like this:
{ "name": "TestType", "meta-type": "object", "members": [ { "name": "number", "type": "int" } ], "features": [ "allow-negative-numbers" ] }
This patch implements feature flags only for struct types. We'll implement them more widely as needed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190606153803.5278-2-armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v4.0.0, v4.0.0-rc4, v3.0.1, v4.0.0-rc3, v4.0.0-rc2, v4.0.0-rc1, v4.0.0-rc0 |
|
#
8ee06f61 |
| 13-Dec-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: Add #if conditions to generated code members
Wrap generated enum and struct members and their supporting code with #if/#endif, using the .ifcond members added in the previous patches.
We do e
qapi: Add #if conditions to generated code members
Wrap generated enum and struct members and their supporting code with #if/#endif, using the .ifcond members added in the previous patches.
We do enum and struct in a single patch because union tag enum and the associated variants tie them together, and dealing with that to split the patch doesn't seem worthwhile.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-18-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
1962bd39 |
| 13-Dec-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: change enum visitor and gen_enum* to take QAPISchemaMember
This will allow to add and access more properties associated with enum values/members, like the associated 'if' condition. We may wan
qapi: change enum visitor and gen_enum* to take QAPISchemaMember
This will allow to add and access more properties associated with enum values/members, like the associated 'if' condition. We may want to have a specialized type QAPISchemaEnumMember, for now this will do.
Modify gen_enum() and gen_enum_lookup() for the same reason.
Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v3.1.0, v3.1.0-rc5, v3.1.0-rc4, v3.1.0-rc3, v3.1.0-rc2, v3.1.0-rc1, v3.1.0-rc0 |
|
#
8c643361 |
| 27-Aug-2018 |
Eric Blake <eblake@redhat.com> |
qapi: Add comments to aid debugging generated introspection
We consciously chose in commit 1a9a507b to hide QAPI type names from the introspection output on the wire, but added a command line option
qapi: Add comments to aid debugging generated introspection
We consciously chose in commit 1a9a507b to hide QAPI type names from the introspection output on the wire, but added a command line option -u to unmask the type name when doing a debug build. The unmask option still remains useful to some other forms of automated analysis, so it will not be removed; however, when it is not in use, the generated .c file can be hard to read. At the time when we first introduced masking, the generated file consisted only of a monolithic C string, so there was no clean way to inject any comments.
Later, in commit 7d0f982b, we switched the generation to output a QLit object, in part to make it easier for future addition of conditional compilation. In fact, commit d626b6c1 took advantage of this by passing a tuple instead of a bare object for encoding the output of conditionals. By extending that tuple, we can now interject strategic comments.
For now, type name debug aid comments are only output once per meta-type, rather than at all uses of the number used to encode the type within the introspection data. But this is still a lot more convenient than having to regenerate the file with the unmask operation temporarily turned on - merely search the generated file for '"NNN" =' to learn the corresponding source name and associated definition of type NNN.
The generated qapi-introspect.c changes only with the addition of comments, such as:
| @@ -14755,6 +15240,7 @@ | { "name", QLIT_QSTR("[485]"), }, | {} | })), | + /* "485" = QCryptoBlockInfoLUKSSlot */ | QLIT_QDICT(((QLitDictEntry[]) { | { "members", QLIT_QLIST(((QLitObject[]) { | QLIT_QDICT(((QLitDictEntry[]) {
Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20180827213943.33524-3-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Rebased, update to qapi-code-gen.txt corrected] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
1aa806cc |
| 27-Aug-2018 |
Eric Blake <eblake@redhat.com> |
qapi: Minor introspect.py cleanups
Commit 7d0f982b changed generated introspection output to no longer produce long lines in the generated .c file, but failed to adjust comments to match. Add some
qapi: Minor introspect.py cleanups
Commit 7d0f982b changed generated introspection output to no longer produce long lines in the generated .c file, but failed to adjust comments to match. Add some clarity that the shorter length that matters most is the overall QMP response on the wire.
Commit 25b1ef31 triggers a pep8 formatting nit.
Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20180827213943.33524-2-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v3.0.0, v3.0.0-rc4, v2.12.1, v3.0.0-rc3, v3.0.0-rc2 |
|
#
25b1ef31 |
| 18-Jul-2018 |
Markus Armbruster <armbru@redhat.com> |
qapi: Make 'allow-oob' optional in SchemaInfoCommand
Making 'allow-oob' optional in SchemaInfoCommand permits omitting it in the common case. Shrinks query-qmp-schema's output from 122.1KiB to 118.
qapi: Make 'allow-oob' optional in SchemaInfoCommand
Making 'allow-oob' optional in SchemaInfoCommand permits omitting it in the common case. Shrinks query-qmp-schema's output from 122.1KiB to 118.6KiB for me.
Note that out-of-band execution is still experimental (you have to configure the monitor with x-oob=on to use it).
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180718090557.17248-1-armbru@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
show more ...
|
Revision tags: v3.0.0-rc1, v3.0.0-rc0 |
|
#
1f214ee1 |
| 05-Jul-2018 |
Markus Armbruster <armbru@redhat.com> |
qapi: Do not expose "allow-preconfig" in query-qmp-schema
According to commit 047f7038f58, option --preconfig
[...] allows pausing QEMU in the new RUN_STATE_PRECONFIG state, allowing the co
qapi: Do not expose "allow-preconfig" in query-qmp-schema
According to commit 047f7038f58, option --preconfig
[...] allows pausing QEMU in the new RUN_STATE_PRECONFIG state, allowing the configuration of QEMU from QMP before the machine jumps into board initialization code of machine_run_board_init()
The intent is to allow management to query machine state and additionally configure it using previous query results within one QEMU instance (i.e. eliminate the need to start QEMU twice, 1st to query board specific parameters and 2nd for actual VM start using query results for additional parameters).
The implementation is a bit of a hack: it splices in an additional main loop before machine creation, in special runstate preconfig. New command exit-preconfig exits that main loop. QEMU continues initializing, creates the machine, and runs the good old main loop. The replacement of the main loop is transparent to monitors.
Sadly, some commands expect initialization to be complete. Running them in --preconfig's main loop violates their preconditions. Since we don't really know which commands are safe, we use a whitelist. This drags the concept of run state into the QMP core.
The whitelist is done as a command flag in the QAPI schema (commit d6fe3d02e9a). Drags the concept of run state further into the QAPI language.
The command flag is exposed in query-qmp-schema (also commit d6fe3d02e9a). This makes it ABI.
I consider the whole thing an offensively ugly hack, but sometimes an ugly hack is the best we can do to solve a problem people have.
The need described by the commit message quote above is genuine. The proper solution would be a main loop that permits complete configuration via QMP. This is out of reach, thus the hack.
However, even though the need is genuine, it isn't urgent: libvirt is not going to use this anytime soon. Baking a hack into ABI before it has any users is a bad idea.
This commit reverts the parts of commit d6fe3d02e9a that affect ABI via query-qmp-schema. The commit did the following:
(1) Add command flag 'allow-preconfig' to the QAPI schema language
(2) Pass it to code generators
(3) Have the commands.py code generator pass it to the command registry (so commit 047f7038f58 can use it as whitelist)
(4) Add 'allow-preconfig' to SchemaInfoCommand (neglecting to update qapi-code-gen.txt section "Client JSON Protocol introspection")
(5) Set 'allow-preconfig': true for commands qmp_capabilities, query-commands, query-command-line-options, query-status
Revert exactly (4), plus a bit of documentation added to qemu-tech.info in commit 047f7038f58.
Shrinks query-qmp-schema's output from 126.5KiB to 121.8KiB for me.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180705091402.26244-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Igor Mammedov <imammedo@redhat.com> [Straightforward conflict with commit d626b6c1ae7 resolved]
show more ...
|