qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 10/19] Add a query-machines command to QMP
Date: Wed, 9 Jun 2010 17:06:24 -0300	[thread overview]
Message-ID: <20100609170624.2d4003cb@redhat.com> (raw)
In-Reply-To: <4C0D276C.6060206@codemonkey.ws>

On Mon, 07 Jun 2010 12:07:56 -0500
Anthony Liguori <anthony@codemonkey.ws> wrote:

> On 06/07/2010 11:44 AM, Daniel P. Berrange wrote:
> > On Mon, Jun 07, 2010 at 10:13:27AM -0500, Anthony Liguori wrote:
> >    
> >> On 06/07/2010 09:42 AM, Daniel P. Berrange wrote:
> >>      
> >>> Add a new QMP monitor command 'query-machines' to discover what
> >>> machines are defined in the QEMU binary. This is an easily
> >>> parsable replacement for 'qemu -M ?'
> >>>
> >>>      [
> >>>          {
> >>>              "name": "pc-0.13",
> >>>              "description": "Standard PC",
> >>>              "default": 0
> >>>          },
> >>>          {
> >>>              "name": "pc",
> >>>              "description": "Standard PC",
> >>>              "canonical": "pc-0.13",
> >>>              "default": 1
> >>>          },
> >>>          {
> >>>              "name": "pc-0.12",
> >>>              "description": "Standard PC",
> >>>              "default": 0
> >>>          },
> >>>          ....
> >>>      ]
> >>>
> >>> No legacy readline monitor output is provided.
> >>>
> >>> In the future it would be desirable for each machine's QDict to
> >>> also include details of any qdev devices that are included by
> >>> default in the machine type.
> >>>
> >>> Signed-off-by: Daniel P. Berrange<berrange@redhat.com>
> >>> ---
> >>>   hw/boards.h |    1 +
> >>>   monitor.c   |    9 +++++++
> >>>   vl.c        |   70
> >>>   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>>   3 files changed, 80 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/hw/boards.h b/hw/boards.h
> >>> index 6f0f0d7..2f6003d 100644
> >>> --- a/hw/boards.h
> >>> +++ b/hw/boards.h
> >>> @@ -32,6 +32,7 @@ typedef struct QEMUMachine {
> >>>   } QEMUMachine;
> >>>
> >>>   int qemu_register_machine(QEMUMachine *m);
> >>> +void do_info_machines(Monitor *mon, QObject **data);
> >>>
> >>>   extern QEMUMachine *current_machine;
> >>>
> >>> diff --git a/monitor.c b/monitor.c
> >>> index f0406e8..b6aa2b4 100644
> >>> --- a/monitor.c
> >>> +++ b/monitor.c
> >>> @@ -55,6 +55,7 @@
> >>>   #include "json-streamer.h"
> >>>   #include "json-parser.h"
> >>>   #include "osdep.h"
> >>> +#include "hw/boards.h"
> >>>
> >>>   //#define DEBUG
> >>>   //#define DEBUG_COMPLETION
> >>> @@ -2449,6 +2450,14 @@ static const mon_cmd_t info_cmds[] = {
> >>>           .mhandler.info_new = do_info_version,
> >>>       },
> >>>       {
> >>> +        .name       = "machines",
> >>> +        .args_type  = "",
> >>> +        .params     = "",
> >>> +        .help       = "show the machine boards",
> >>> +        .user_print = monitor_user_noop,
> >>> +        .mhandler.info_new = do_info_machines,
> >>> +    },
> >>> +    {
> >>>           .name       = "commands",
> >>>           .args_type  = "",
> >>>           .params     = "",
> >>> diff --git a/vl.c b/vl.c
> >>> index 0b38d62..8043fac 100644
> >>> --- a/vl.c
> >>> +++ b/vl.c
> >>> @@ -1537,6 +1537,76 @@ static QEMUMachine *find_default_machine(void)
> >>>       return NULL;
> >>>   }
> >>>
> >>> +
> >>> +/**
> >>> + * do_info_machines(): Show machine boards
> >>> + *
> >>> + * Returns a QList object listing all machine boards
> >>> + * available with this QEMU target. Each element in
> >>> + * the list is a QDict object containing the following
> >>> + * keys
> >>> + *
> >>> + *  - "name": short name for the machine board
> >>> + *  - "description": long description of the board
> >>> + *  - "alias": name of an alias
> >>> + *
> >>> + * Example:
> >>> + *
> >>> + *  [
> >>> + *     {
> >>> + *       "name": "pc-0.13",
> >>> + *        "description": "Standard PC",
> >>> + *        "default": 0
> >>> + *     },
> >>> + *     {
> >>> + *       "name": "pc",
> >>> + *       "description": "Standard PC",
> >>> + *       "canonical": "pc-0.13",
> >>> + *       "default": 1
> >>> + *     },
> >>> + *     {
> >>> + *       "name": "pc-0.12",
> >>> + *       "description": "Standard PC",
> >>> + *       "default": 0
> >>> + *     },
> >>> + *     ....
> >>> + *  ]
> >>> + *
> >>> + */
> >>>
> >>>        
> >> My only suggestion would be to:
> >>
> >> { 'default-machine': 'pc',
> >>     'machines': [{
> >>       'name': 'pc',
> >>       'description': 'Standard PC',
> >>     },...]
> >> }
> >>
> >> I'd drop 'canonical' too.  Aliasing is an implementation detail and
> >> should not be exposed via the ABI.
> >>      
> > The alias/canonical mapping is something that libvirt needs to know in
> > order guarentee stable guest ABI for all configs it has.
> >
> > What happens is that an app using libvirt will request a guest config
> > with machine type 'pc',
> 
> Does the guest config encode the machine type?  Does that mean that I 
> can't specify pc-0.12 or pc-0.13?

 What about this string format 'pc-0.12', do we really want that kind
of string in QMP? Shouldn't it be broken into 'machine_type' and
'machine_version'?

> 
> Since most guests don't specify an explicit machine, can't libvirt just 
> use pc-<version> and be done with it?
> 
> Regards,
> 
> Anthony Liguori
> 
> >   and libvirt resolves that to the canonical
> > type 'pc-0.12', and then launches QEMU with '-M pc-0.12' instead of
> > the '-M pc'. If libvirt passed '-M pc' and let QEMU do the canonicalization,
> > the guest ABI would no longer be stable across QEMU upgrades because the
> > canonicalization changes to point to the newer version.
> >
> > Regards,
> > Daniel
> >    
> 
> 

  parent reply	other threads:[~2010-06-09 20:06 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 [this message]
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 ` [Qemu-devel] [PATCH 00/19] RFC: Reporting QEMU binary capabilities Anthony Liguori
2010-06-07 15:10   ` 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=20100609170624.2d4003cb@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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).