qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 00/19] RFC: Reporting QEMU binary capabilities
Date: Mon, 07 Jun 2010 09:58:11 -0500	[thread overview]
Message-ID: <4C0D0903.50207@codemonkey.ws> (raw)
In-Reply-To: <1275921752-29420-1-git-send-email-berrange@redhat.com>

On 06/07/2010 09:42 AM, Daniel P. Berrange wrote:
> As everyone here agrees, having management apps parse -help output
> to determine the QEMU capabilities is not at all nice, because it
> is an ill-defined&  fragile data format. Looking more broadly these
> same issues apply to all the other command line options that accept
> a '?' flag for querying capabilities.
>
> We have a very nice structured data format we could be using for
> this: JSON. What's lacking is code to output all this information
> in the JSON format. This patch series can thus be summarized as
> 'JSON for everything'
>    

I'm slightly skeptical that JSON is the right format for this TBH.

> For reference, here is the full list of information libvirt currently
> queries from QEMU:
>
>    * Detection of command line flags (-help parsing)
>
>      -no-kqemu, -no-kvm, -enable-kvm, -no-reboot
>      -name, -uuid, -xen-domid, -domid, -drive
>      -vga, -std-vga, -pcidevice, -mem-path
>      -chardev, -balloon, -device, -rtc, -rtc-td-hack
>      -no-hpet, -no-kvm-pit-reinjection, -tdf
>      -fsdev -sdl
>    

Most of these things can be associated with a config option and/or a 
version.

>    * Detection of parameters (-help parsing)
>
>       -drive format=
>       -drive boot=
>       -drive serial=
>       -drive cache=
>       -cpu cores=, threads=, sockets=
>       -netdev vhost=
>    

Likewise.

>    * Detection of parameter values (-help parsing)
>
>       -drive cache=writethrough|writeback|none
>         vs
>       -drive cache=default|on|off
>    

Same here.

>    * Version number  (-help parsing)
>
>      -netdev  + 0.13.0
>
>      0.9.0  for VNC syntax
>
>      0.10.0 for vnet hdr
>
>    * Parse -M ?  output to get list of machine types + aliases
>    

Yeah, it would be a good to have a qmp command to list supported machines.

>    * Parse -device pci-assign,? to check for 'configfd' parameter
>
>    * Parse -cpu ?  to get list of named CPU types
>    

Would be good to have qmp for this too.

>    * Parse binary name (qemu-system-XXXX) to guess arch of target
>    

Same here.

> This isn't an 100% exhaustive list of things that we would like
> to be able to get access to though. It can likely cover all of
> the following:
>
>   * Version
>
>        QEMU major, minor, micro numbers. KVM version. Package
>        version
>
>   * Devices
>
>        List of device names. Parameter names. Parameter value
>        data types. Allowed strings for enums
>
>   * Arguments
>
>        List of command line arguments. Parameter names. Parameter
>        value data types. Allowed strings for enums
>    

I'm a bit sceptical that this is the right thing to offer.

Generally speaking, libvirt is not going to be capable of handling every 
possible combination of qemu features.  Instead, for 0.12 it will use 
this set of functionality, for 0.13 it might use a different set.

>   * Machine types
>
>        List of names + aliases
>        List of default devices in machine
>
>   * CPU types
>
>        List of names, associated feature flags, all allowed
>        feature flags
>
>   * Target info
>
>        Arch name, wordsize
>
>   * Monitor commands
>
>        List of all monitor commands. Parameter names. Parameter
>        value data types. Allowed strings for enums
>
>   * Block device backends
>
>        List of all block device backends. Parameter names.
>        Parameter value data types. Allowed strings for enums
>
>   * Netdev device backends
>
>        List of all netdev device backends. Parameter names.
>        Parameter value data types. Allowed strings for enums
>
>   * Chardev device backends
>
>        List of all chardev device backends. Parameter names.
>        Parameter value data types. Allowed strings for enums
>
>
> This patch series attempts to satisfy as much of this as is
> feasible with the current QEMU codebase structure. The series
> comprises four stages
>
>   * Some basic infrastructure. Support for JSON pretty printing.
>     Introduction of standardized helpers for converting enums
>     to/from strings. Introduction of an 'enum' data type for
>     QemuOpt to expose a formal list of valid values&  simplify
>     config handling / parsing. Compile time assertion checking
>
>   * Convert driver, netdev&  rtc config options to use the new
>     enum data type for all appropriate args
>
>   * Add new QMP monitor commands exposing data for machine
>     types, devices, cpu types, arch target, argv, config params,
>     and netdev backends.
>
>   * Add a new '-capabilities' command line arg as syntactic
>     sugar for the monitor commands that just report on static
>     info about the QEMU binary.
>
> The main problem encountered with this patch series is the
> split between argv and config parameters. The qemu-config.c
> file provides the information is a good data format, allowing
> programatic access to the list of parameters for each config
> option (eg, the 'cache', 'file', 'aio', etc bits for -drive).
> There are some issues with it though
>
>   - It lacks a huge amount of coverage wrt to the full argv
>     available, even simple things like the '-m' argument
>     don't exist.
>
>   - It is inconsistent in handling parameters. eg it  hands
>     off validation of netdev backends to other code, to allow
>     for handling of different parameters for tap vs user vs
>     socket backends.  For chardev backends though, it directly
>     includes a union of all possible parameters.
>
> Ideally the 'query-argv' command would not be required, but
> unless those problems with the qemu-config are resolved, it
> is the only way to access alot of the information. This is
> sub-optimal because although it lets apps easily determine
> whether an arg like '-smp' is present, it still leaves them
> parsing that args' help string to discover parameters.
>    

A query-argv is a really bad idea IMHO.

Regards,

Anthony Liguori

> This series is lacking a 'query-blockdev' and 'query-chardev'
> commands to report on availability of backends for -blockdev
> and '-chardev' commands.
>
> Finally the existing 'query-commands' output is lacking any
> information about the parameters associated with each command.
> This needs to be addressed somehow.
>
> In summary though, IMHO, this patch series provides a good
> base for providing information about static QEMU binary
> capabilities to applications. It should ensure apps never
> again need to go anywhere near -help, -M ?, -cpu ?, -device ?,
> -soundhw ? and other such ill defined output formats.
>
> NB, I know this patch series will probably clash horribly
> with other patch series recently posted for review, in
> particular Jes' cleanup of vl.c   I will rebase as required
> if any of those get merged.
>
> This series is currently based on GIT master as of:
>
>    commit fd1dc858370d9a9ac7ea2512812c3a152ee6484b
>    Author: Edgar E. Iglesias<edgar.iglesias@gmail.com>
>    Date:   Mon Jun 7 11:54:27 2010 +0200
>
> Regards,
> Daniel
>
>   Makefile.objs                |    2
>   block.c                      |   32 +-
>   block.h                      |   55 ++++
>   cpus.c                       |   78 ++++++
>   cpus.h                       |    1
>   hw/boards.h                  |    2
>   hw/mc146818rtc.c             |    8
>   hw/qdev.c                    |  148 +++++++++++++
>   hw/qdev.h                    |    2
>   monitor.c                    |  167 ++++++++++++++
>   monitor.h                    |    5
>   net.c                        |  173 ++++++++++-----
>   net.h                        |    2
>   qemu-config.c                |  228 +++++++++++++++++++-
>   qemu-config.h                |    2
>   qemu-enum.c                  |   44 +++
>   qemu-enum.h                  |   45 ++++
>   qemu-option.c                |   35 +++
>   qemu-option.h                |   14 +
>   qemu-options.hx              |    9
>   qjson.c                      |   55 ++++
>   qjson.h                      |    1
>   sysemu.h                     |   43 +++
>   target-arm/cpu.h             |    7
>   target-arm/helper.c          |   21 +
>   target-cris/cpu.h            |    7
>   target-cris/translate.c      |   22 +
>   target-i386/cpu.h            |    7
>   target-i386/cpuid.c          |   79 +++++++
>   target-m68k/cpu.h            |    9
>   target-m68k/helper.c         |   23 ++
>   target-mips/cpu.h            |    7
>   target-mips/translate.c      |    4
>   target-mips/translate_init.c |   19 +
>   target-ppc/cpu.h             |    7
>   target-ppc/translate.c       |    4
>   target-ppc/translate_init.c  |   17 +
>   target-sh4/cpu.h             |    8
>   target-sh4/translate.c       |   23 ++
>   target-sparc/cpu.h           |    9
>   target-sparc/helper.c        |   60 +++++
>   verify.h                     |  164 ++++++++++++++
>   vl.c                         |  482 +++++++++++++++++++++++++++++--------------
>   43 files changed, 1869 insertions(+), 261 deletions(-)
>
>
>
>    

  parent reply	other threads:[~2010-06-07 14:58 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 14:42 [Qemu-devel] [PATCH 00/19] RFC: Reporting QEMU binary capabilities Daniel P. Berrange
2010-06-07 14:42 ` [Qemu-devel] [PATCH 01/19] Add support for JSON pretty printing Daniel P. Berrange
2010-06-09 19:51   ` Luiz Capitulino
2010-06-07 14:42 ` [Qemu-devel] [PATCH 02/19] Add support for compile time assertions Daniel P. Berrange
2010-06-07 15:35   ` [Qemu-devel] " Paolo Bonzini
2010-06-07 14:42 ` [Qemu-devel] [PATCH 03/19] Add enum handlers for easy & efficient string <-> int conversion Daniel P. Berrange
2010-06-09 19:52   ` Luiz Capitulino
2010-06-26  6:52   ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 04/19] Add support for a option parameter as an enum Daniel P. Berrange
2010-06-26  6:59   ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 05/19] Ensure that QEMU exits if drive_add parsing fails Daniel P. Berrange
2010-06-26  7:04   ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 06/19] Convert drive options to use enumeration data type Daniel P. Berrange
2010-06-09 19:52   ` Luiz Capitulino
2010-06-26  7:07   ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 07/19] Convert netdev client types to use an enumeration Daniel P. Berrange
2010-06-07 15:09   ` Anthony Liguori
2010-06-07 15:13     ` Daniel P. Berrange
2010-06-07 14:42 ` [Qemu-devel] [PATCH 08/19] Convert RTC to use enumerations for configuration parameters Daniel P. Berrange
2010-06-09 19:54   ` Luiz Capitulino
2010-06-07 14:42 ` [Qemu-devel] [PATCH 09/19] Change 'query-version' to output broken down version string Daniel P. Berrange
2010-06-07 15:11   ` Anthony Liguori
2010-06-09 20:04     ` Luiz Capitulino
2010-06-07 14:42 ` [Qemu-devel] [PATCH 10/19] Add a query-machines command to QMP Daniel P. Berrange
2010-06-07 15:13   ` Anthony Liguori
2010-06-07 16:44     ` Daniel P. Berrange
2010-06-07 17:07       ` Anthony Liguori
2010-06-07 17:14         ` Daniel P. Berrange
2010-06-09 20:06         ` Luiz Capitulino
2010-06-07 14:42 ` [Qemu-devel] [PATCH 11/19] Add a query-devices " Daniel P. Berrange
2010-06-07 15:14   ` Anthony Liguori
2010-06-07 16:03     ` Daniel P. Berrange
2010-06-26  7:12       ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 12/19] Add a query-cputypes " Daniel P. Berrange
2010-06-26  7:18   ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 13/19] Add a query-target " Daniel P. Berrange
2010-06-07 15:43   ` [Qemu-devel] " Paolo Bonzini
2010-06-07 14:42 ` [Qemu-devel] [PATCH 14/19] Add a query-argv " Daniel P. Berrange
2010-06-07 15:01   ` Anthony Liguori
2010-06-10 15:34     ` [Qemu-devel] " Paolo Bonzini
2010-06-26  7:30     ` [Qemu-devel] " Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 15/19] Expand query-argv to include help string Daniel P. Berrange
2010-06-07 14:42 ` [Qemu-devel] [PATCH 16/19] Add a query-netdev command to QMP Daniel P. Berrange
2010-06-07 15:15   ` Anthony Liguori
2010-06-26  7:32     ` Markus Armbruster
2010-06-07 19:13   ` Miguel Di Ciurcio Filho
2010-06-08  8:38     ` Daniel P. Berrange
2010-06-07 14:42 ` [Qemu-devel] [PATCH 17/19] Add a query-config " Daniel P. Berrange
2010-06-26  7:34   ` Markus Armbruster
2010-06-07 14:42 ` [Qemu-devel] [PATCH 18/19] Add option to turn on JSON pretty printing in monitor Daniel P. Berrange
2010-06-07 14:42 ` [Qemu-devel] [PATCH 19/19] Add a -capabilities argument to allow easy query for static QEMU info Daniel P. Berrange
2010-06-07 16:04   ` [Qemu-devel] " Paolo Bonzini
2010-06-07 16:09     ` Daniel P. Berrange
2010-06-07 16:04   ` [Qemu-devel] " Anthony Liguori
2010-06-07 14:58 ` Anthony Liguori [this message]
2010-06-07 15:10   ` [Qemu-devel] [PATCH 00/19] RFC: Reporting QEMU binary capabilities Daniel P. Berrange
2010-06-07 15:18     ` Anthony Liguori
2010-06-07 16:02   ` [Qemu-devel] " Paolo Bonzini
2010-06-07 16:03     ` Anthony Liguori
2010-06-07 16:07 ` [Qemu-devel] " Anthony Liguori
2010-06-09 20:25   ` Luiz Capitulino
2010-06-26  6:45 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C0D0903.50207@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).