diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-07-05 11:14:01 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-07-16 15:35:57 +0200 |
commit | 1f214ee1b83afd10fd5e1b63f4ecc03f9a8115c4 (patch) | |
tree | 7540ccb84003cd1470cf64c64f8d61880021e46f | |
parent | 633e824037210a60c0b23d6c0e42420db1fe4c08 (diff) | |
download | qemu-1f214ee1b83afd10fd5e1b63f4ecc03f9a8115c4.zip qemu-1f214ee1b83afd10fd5e1b63f4ecc03f9a8115c4.tar.gz qemu-1f214ee1b83afd10fd5e1b63f4ecc03f9a8115c4.tar.bz2 |
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]
-rw-r--r-- | qapi/introspect.json | 5 | ||||
-rw-r--r-- | qemu-tech.texi | 3 | ||||
-rw-r--r-- | scripts/qapi/introspect.py | 4 |
3 files changed, 3 insertions, 9 deletions
diff --git a/qapi/introspect.json b/qapi/introspect.json index 80a0a3e..c7f67b7 100644 --- a/qapi/introspect.json +++ b/qapi/introspect.json @@ -262,16 +262,13 @@ # @allow-oob: whether the command allows out-of-band execution. # (Since: 2.12) # -# @allow-preconfig: command can be executed in preconfig runstate, -# default: false (Since 3.0) -# # TODO: @success-response (currently irrelevant, because it's QGA, not QMP) # # Since: 2.5 ## { 'struct': 'SchemaInfoCommand', 'data': { 'arg-type': 'str', 'ret-type': 'str', - 'allow-oob': 'bool', 'allow-preconfig': 'bool' } } + 'allow-oob': 'bool' } } ## # @SchemaInfoEvent: diff --git a/qemu-tech.texi b/qemu-tech.texi index dcecba8..f843341 100644 --- a/qemu-tech.texi +++ b/qemu-tech.texi @@ -350,9 +350,6 @@ depend on an initialized machine, including but not limited to: @item query-status @item exit-preconfig @end table -The full list of commands is in QMP schema which could be queried with -query-qmp-schema, where commands supported at preconfig state have option -'allow-preconfig' set to true. @node Bibliography @section Bibliography diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 71d4a77..70ca5dd 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -187,8 +187,8 @@ const QLitObject %(c_name)s = %(c_string)s; self._gen_qlit(name, 'command', {'arg-type': self._use_type(arg_type), 'ret-type': self._use_type(ret_type), - 'allow-oob': allow_oob, - 'allow-preconfig': allow_preconfig}, ifcond) + 'allow-oob': allow_oob}, + ifcond) def visit_event(self, name, info, ifcond, arg_type, boxed): arg_type = arg_type or self._schema.the_empty_object_type |