qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: jyang@redhat.com, laine@redhat.com, rjones@redhat.com,
	libvir-list@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com,
	anthony@codemonkey.ws, pbonzini@redhat.com,
	lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/5] query-command-line-options: return help message for legacy options
Date: Mon, 17 Feb 2014 16:56:18 +0800	[thread overview]
Message-ID: <20140217085618.GD21308@amosk.info> (raw)
In-Reply-To: <52FBE103.6000709@redhat.com>

On Wed, Feb 12, 2014 at 02:00:51PM -0700, Eric Blake wrote:
> On 01/27/2014 08:53 PM, Amos Kong wrote:
> > Some legacy options that have arguments weren't added to
> > vm_config_groups[], so query-command-line-options returns a
> > NULL parameters infolist. This patch try to return help message
> > for this kind of legacy options.
> > 
> > Example:
> >  {
> >      "helpmsg": "\"-vnc display    start a VNC server on display\\n\"",
> >      "parameters": [
> >      ],
> >      "option": "vnc"
> >  },
> > 
> > Signed-off-by: Amos Kong <akong@redhat.com>
> > ---
> >  qapi-schema.json   | 5 ++++-
> >  util/qemu-config.c | 3 +++
> >  2 files changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/qapi-schema.json b/qapi-schema.json
> > index 05ced9d..b3e6f46 100644
> > --- a/qapi-schema.json
> > +++ b/qapi-schema.json
> > @@ -3943,13 +3943,16 @@
> >  # Details about a command line option, including its list of parameter details
> >  #
> >  # @option: option name
> > +# @helpmsg: help message for legacy options
> 
> Missing "#optional" and "(since 2.0)" designations
> 
> >  #
> >  # @parameters: an array of @CommandLineParameterInfo
> 
> Might be worth documenting "#optional since 2.0" (we don't yet have good
> precedent for documenting when a formerly mandatory field became optional).
> 
> Groan.  This is an output struct.  On input structs, changing a
> mandatory field to optional is safe - old callers will always supply the
> field.  But on output structs, changing a mandatory field to optional is
> backwards-incompatible.  Old callers may be blindly expecting the field,
> and crash when it is not present.
> 
> Your approach needs to be modified.
> 
> >  #
> >  # Since 1.5
> >  ##
> >  { 'type': 'CommandLineOptionInfo',
> > -  'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } }
> > +  'data': { 'option': 'str',
> > +            '*parameters': ['CommandLineParameterInfo'],
> > +            '*helpmsg': 'str' } }
> 
> I suggest:
> 
> 
> # @parameters: array of @CommandLineParameterInfo, possibly empty
> # @argument: @optional present if the @parameters array is empty. If
> #            true, then the option takes unspecified arguments, if
> #            false, then the option is merely a boolean flag (since 2.0)
> 
> { 'type': 'CommandLineOptionInfo',
> 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'],
>           '*argument': 'bool' } }
> 
> used as:
> [
>   { "option":"enable-fips", "parameters":[], "argument":false },
>   { "option":"smbios", "parameters":[], "argument":true },
>   { "option":"iscsi", "paramters":[ ... ] },
>   ...
> ]
 
It's ok to use a split "argument" to indicate if option has
parameters. and the parameters will not be optional, it will
be NULL list in the case of no parameters.

Thanks.

> which adequately differentiates between -iscsi taking arguments (but
> where we haven't yet hooked it in to introspect those arguments) vs.
> -enable-fips being boolean.
> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 


-- 
			Amos.

  reply	other threads:[~2014-02-17  8:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28  3:53 [Qemu-devel] [PATCH 0/5] fix query-command-line-options Amos Kong
2014-01-28  3:53 ` [Qemu-devel] [PATCH 1/5] qmp: rename query_option_descs() to get_param_infolist() Amos Kong
2014-02-12 20:33   ` Eric Blake
2014-01-28  3:53 ` [Qemu-devel] [PATCH 2/5] introduce two marcos to dump the options info Amos Kong
2014-02-11 10:55   ` Markus Armbruster
2014-02-12 20:37   ` Eric Blake
2014-01-28  3:53 ` [Qemu-devel] [PATCH 3/5] query-command-line-options: query all the options in qemu-options.hx Amos Kong
2014-02-11 12:03   ` Markus Armbruster
2014-02-17  8:26     ` Amos Kong
2014-02-12 20:39   ` Eric Blake
2014-01-28  3:53 ` [Qemu-devel] [PATCH 4/5] introduce QEMU_OPTIONS_GENERATE_HELPMSG Amos Kong
2014-02-11 12:03   ` Markus Armbruster
2014-02-12 20:41   ` Eric Blake
2014-01-28  3:53 ` [Qemu-devel] [PATCH 5/5] query-command-line-options: return help message for legacy options Amos Kong
2014-02-11 12:19   ` Markus Armbruster
2014-02-12 20:48     ` Eric Blake
2014-02-17  8:49     ` Amos Kong
2014-02-12 21:00   ` Eric Blake
2014-02-17  8:56     ` Amos Kong [this message]
2014-02-10 20:26 ` [Qemu-devel] [PATCH 0/5] fix query-command-line-options Luiz Capitulino

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=20140217085618.GD21308@amosk.info \
    --to=akong@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jyang@redhat.com \
    --cc=laine@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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).