qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: aliguori@us.ibm.com, Amos Kong <akong@redhat.com>,
	qemu-devel@nongnu.org, jyang@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5] monitor: introduce query-command-line-options
Date: Thu, 25 Apr 2013 08:11:03 -0600	[thread overview]
Message-ID: <51793977.4080602@redhat.com> (raw)
In-Reply-To: <20130425092050.41428940@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3299 bytes --]

On 04/25/2013 07:20 AM, Luiz Capitulino wrote:
> On Thu, 25 Apr 2013 17:50:35 +0800
> Amos Kong <akong@redhat.com> wrote:
> 
>> Libvirt has no way to probe if an option or property is supported,
>> This patch introduces a new qmp command to query command line
>> option information. hmp command isn't added because it's not needed.
>>
>> Signed-off-by: Amos Kong <akong@redhat.com>
>> CC: Luiz Capitulino <lcapitulino@redhat.com>
>> CC: Osier Yang <jyang@redhat.com>
>> CC: Anthony Liguori <aliguori@us.ibm.com>
> 
> This version looks good to me, but it has two small problems.
> 
> First, some options like -drive, -net, -netdev and -device have an empty
> QemuOptsList, meaning that option validation is not done upfront.
> 
> The other problem is that we're returning some options which seem to be
> created at run-time and I honestly have never heard of them, like tmpdev
> and acpi.
> 
> I think there are two possible fixes for both issues:
> 
>  1. Do nothing, accept patch as is and fix things in 1.6

I can live with this for 1.5.  Initially, libvirt will probably only be
querying whether a set of known option names exist, and not looking at
the parameter definitions tied to the option nor trying to invoke
command line options that libvirt doesn't already know.  Put another
way, the driving factor to get this into 1.5 is so that libvirt knows
whether it can use -mem-merge:

https://www.redhat.com/archives/libvir-list/2013-April/msg01263.html

While I anticipate that future libvirt versions may get fancier and use
even more details of option introspection, such as learning whether a
parameter was added in a later release, that's not the driving factor
right now.

> 
>  2. Don't return an option when 'desc' is NULL

That might backfire; it's better to output too much than too little.

> 
> I'm willing to do 1, as those options don't return any options anyway and
> I don't believe any client will mess with them (worst case the client will pass
> an option qemu doesn't accept and will refuse to run).

Yep, and libvirt certainly won't be calling 'qemu -tmpdev'.

> 
> I have one more comment below, but case we accept to do 1 I can fix it myself.
> 

>> +{'command': 'query-command-line-options', 'data': { '*option': 'str' },
> 
> I'm not a huge fan of option being optional, I prefer dropping it and making
> the command simpler. But I won't refuse the patch because of that.

I'm leaving that up to you.  I personally like the idea of filtering (I
would definitely use it via 'virsh qemu-monitor-command' when doing
development work on libvirt), but it's not essential.

>> +    if (conf_list == NULL) {
>> +        error_set(errp, QERR_INVALID_OPTION_GROUP, option);
> 
> You should be using error_setg() like:
> 
>  error_setg(errp, "invalid option name: %s", option);
> 
> But I can fix that myself in qmp branch.

Based on include/qapi/qmp/qerror.h, the message you would be replacing is:

#define QERR_INVALID_OPTION_GROUP \
    ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'"

Yeah, "invalid option name: foo" reads better than "There is no option
group 'foo'".

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-04-25 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25  9:50 [Qemu-devel] [PATCH v5] monitor: introduce query-command-line-options Amos Kong
2013-04-25 13:20 ` Luiz Capitulino
2013-04-25 14:11   ` Eric Blake [this message]
2013-04-25 15:48   ` Osier Yang
2013-04-25 16:32     ` Eric Blake
2013-04-25 13:57 ` Eric Blake
2013-04-25 15:07   ` 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=51793977.4080602@redhat.com \
    --to=eblake@redhat.com \
    --cc=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jyang@redhat.com \
    --cc=lcapitulino@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).