On 11/11/20 13:53, Kevin Wolf wrote:
QDicts are one step closer to the final result, but would also have to
be processed separately as they need only half of the processing that
command line options need. Eventually, qobject_input_visitor_new_str()
is what we want to use to parse strings directly into QAPI objects, and
QDicts are only an internal intermediate result there.
To be clearer, the processing would look like this:
- both qemu_config_parse and qemu_read_config_file call a static
function qemu_config_foreach
- qemu_config_foreach builds a QDict and passes it to a callback
qemu_read_config_file receives a callback argument from vl.c, while
qemu_config_parse uses a default callback that does qemu_opts_create and
qemu_opts_absorb_qdict.
The callback in vl.c does this:
1) for a keyval-based non-mergeable option (e.g. -object) -> do
qdict_crumple and store the QDict for later processing.
2) for a keyval-based mergeable option (e.g. -M) -> do qdict_crumple and
merge with previous command-line options using a new function keyval_merge
3) for non-keyval options -> forward to the default callback used by
qemu_config_parse.
Later on, keyval-based options are parsed into QAPI objects or QOM
properties using qobject_input_visitor_new_keyval.
So while it's even uglier, maybe what we should do with -readconfig is
convert it back to strings and then run the result through the normal
command line processing? This would get rid of the special cases.
That would be more or less doable but there are two problems: 1) the
-readconfig code is used for blkdebug too, so you would need some kind
of callback anyway 2) converting to strings is not entirely trivial due
to e.g. different spelling between the "-boot" command line option and
the "boot-opts" group.
Both options are probably only hacks for the short term, so either way I
think I'd still prefer deprecating -readconfig now, in favour of command
line options as long as we don't have a QAPI based config file.
"Now" is a bit too late for 5.2. I would like to deprecate "-set" for
that matter too, but it's so obscure that I'm thinking of just dropping
it in 6.0.
Paolo