mbox series

[RFC,00/12] Remove QemuOpts usage for HMP, -object and -readconfig

Message ID 20201111142537.1213209-1-pbonzini@redhat.com (mailing list archive)
Headers show
Series Remove QemuOpts usage for HMP, -object and -readconfig | expand

Message

Paolo Bonzini Nov. 11, 2020, 2:25 p.m. UTC
This is yet another RFC on the command-line parsing overhaul.  Here,
I'm switching HMP, -object and -readconfig away from QemuOpts.  There are
pending QemuOpts and keyval patches that make the syntaxes the same
apart from:

- "implicit value" options (where the lack of value is turned
into "on" or "off"), which will be deprecated

- the processing of invalid, empty or overlong keys which can be considered
bugfixes.

Along the way, the object_add HMP command grows help support.

The plan on top of this is to also keyval-ify -M and -accel.  The reason
for this, in my evil plan, is to allow for compound properties.  These
compound properties would be used for replacements of options like -smp
(-M smp.xxx), -icount (-accel tcg,icount.xxx) and -chardev (as in -object
chardev-socket,addr.host).

Paolo

Paolo Bonzini (12):
  tests: convert check-qom-proplist to keyval
  keyval: introduce keyval_parse_into
  hmp: replace "O" parser with keyval
  qom: use qemu_printf to print help for user-creatable objects
  hmp: special case help options for object_add
  qemu-io: use keyval for -object parsing
  qemu-nbd: use keyval for -object parsing
  qemu-img: use keyval for -object parsing
  qemu-config: add error propagation to qemu_config_parse
  qemu-config: parse configuration files to a QDict
  qemu-option: support accept-any QemuOptsList in qemu_opts_absorb_qdict
  qemu: use keyval for -object parsing

 block/blkdebug.c                |   3 +-
 hmp-commands.hx                 |   6 +-
 include/qemu/config-file.h      |   8 +-
 include/qemu/option.h           |   2 +
 include/qom/object_interfaces.h |  45 +-----
 monitor/hmp-cmds.c              |  22 +--
 monitor/hmp.c                   |  20 ++-
 qemu-img.c                      | 258 +++++++-------------------------
 qemu-io.c                       |  42 ++----
 qemu-nbd.c                      |  42 ++----
 qom/object_interfaces.c         |  57 +------
 softmmu/vl.c                    | 113 ++++++++------
 tests/check-qom-proplist.c      |  58 ++++---
 util/keyval.c                   |  39 ++++-
 util/qemu-config.c              |  99 +++++++-----
 util/qemu-option.c              |   3 +-
 16 files changed, 324 insertions(+), 493 deletions(-)

Comments

Kevin Wolf Nov. 13, 2020, 2:35 p.m. UTC | #1
Am 11.11.2020 um 15:25 hat Paolo Bonzini geschrieben:
> This is yet another RFC on the command-line parsing overhaul.  Here,
> I'm switching HMP, -object and -readconfig away from QemuOpts.  There are
> pending QemuOpts and keyval patches that make the syntaxes the same
> apart from:
> 
> - "implicit value" options (where the lack of value is turned
> into "on" or "off"), which will be deprecated
> 
> - the processing of invalid, empty or overlong keys which can be considered
> bugfixes.
> 
> Along the way, the object_add HMP command grows help support.
> 
> The plan on top of this is to also keyval-ify -M and -accel.  The reason
> for this, in my evil plan, is to allow for compound properties.  These
> compound properties would be used for replacements of options like -smp
> (-M smp.xxx), -icount (-accel tcg,icount.xxx) and -chardev (as in -object
> chardev-socket,addr.host).

I haven't reviewed everything in detail, but this approach looks
workable to me.

Of course, at the moment -object is a bit different from other options
in that it doesn't have a QAPI object for the options, but you just
directly pass QDicts to user_creatable_add_dict(). But plugging in a
visitor for other options groups doesn't suddenly require a different
design, so this is fine.

Kevin