From: Luiz Capitulino <lcapitulino@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org,
afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 2/7] qapi: QMP input visitor, handle floats parsed as ints
Date: Fri, 11 May 2012 14:38:36 -0300 [thread overview]
Message-ID: <20120511143836.7d050709@doriath.home> (raw)
In-Reply-To: <20120511170447.GA28865@illuin>
On Fri, 11 May 2012 12:04:47 -0500
Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> On Fri, May 11, 2012 at 01:22:33PM -0300, Luiz Capitulino wrote:
> > On Fri, 27 Apr 2012 15:21:18 -0500
> > Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> >
> > > JSON numbers can be interpreted as either integers or floating point
> > > values depending on their representation. As a result, QMP input visitor
> > > might visit a QInt when it was expecting a QFloat, so add handling to
> > > account for this.
> > >
> > > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > > ---
> > > qapi/qmp-input-visitor.c | 9 +++++++--
> > > 1 files changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
> > > index 4cdc47d..bc91134 100644
> > > --- a/qapi/qmp-input-visitor.c
> > > +++ b/qapi/qmp-input-visitor.c
> > > @@ -246,13 +246,18 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name,
> > > QmpInputVisitor *qiv = to_qiv(v);
> > > QObject *qobj = qmp_input_get_object(qiv, name);
> > >
> > > - if (!qobj || qobject_type(qobj) != QTYPE_QFLOAT) {
> > > + if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&
> > > + qobject_type(qobj) != QTYPE_QINT)) {
> > > error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
> > > "double");
> >
> > s/double/number
> >
> > It's also important to note that migrate_set_downtime is (positively) affected
> > by this change. Today, it only accepts a double, eg.:
> >
> > { "execute": "migrate_set_downtime", "arguments": { "value": 1 } }
> > {
> > "error": {
> > "class": "InvalidParameterType",
> > "desc": "Invalid parameter type for 'value', expected: double",
> > "data": {
> > "name": "value",
> > "expected": "double"
> > }
> > }
> > }
> >
> > That's a bug (as it's documented to accept a number) and this patch fixes it.
> > There's an interface change, but I think it won't cause problems in practice.
> >
> > Please, fix the error message above and would be nice to get this (and patch
> > 02/07) as a separate series for 1.1.
>
> Hmm, this is kinda awkward because I don't think we can change it without
> breaking any trees based off qom-next.
>
> Since the error msg predates the bug fix (it just becomes more obviously
> wrong as a result of the fix), can you pull these commits as is into your
> QMP tree?
>
> In the meantime I can send another patch, based on qom-next or qmp, that
> fixes the error msg. We can then get all 3 into 1.1/master via QMP tree, and I
> think qom-next should still merge cleanly back into master after 1.1
I think Andreas answered you here (in the sense that it's ok to respin this
patch), but I also would like to add that patch 4/7 doesn't seem a bug fix
to me (at least not worth it for 1.1).
next prev parent reply other threads:[~2012-05-11 18:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1335558083-26196-1-git-send-email-mdroth@linux.vnet.ibm.com>
[not found] ` <1335558083-26196-2-git-send-email-mdroth@linux.vnet.ibm.com>
2012-05-01 21:37 ` [Qemu-devel] [PATCH 1/7] qapi: add Visitor interfaces for uint*_t and int*_t Andreas Färber
[not found] ` <1335558083-26196-7-git-send-email-mdroth@linux.vnet.ibm.com>
2012-05-01 21:52 ` [Qemu-devel] [PATCH 6/7] qdev: use int32_t container for devfn property Andreas Färber
[not found] ` <1335558083-26196-8-git-send-email-mdroth@linux.vnet.ibm.com>
2012-05-01 21:54 ` [Qemu-devel] [PATCH 7/7] qdev: switch property accessors to fixed-width visitor interfaces Andreas Färber
2012-05-01 22:02 ` [Qemu-devel] [PATCH v5 0/7] add fixed-width visitors and serialization tests/fixes Andreas Färber
2012-05-11 1:22 ` Andreas Färber
2012-05-11 15:19 ` Michael Roth
[not found] ` <1335558083-26196-3-git-send-email-mdroth@linux.vnet.ibm.com>
2012-05-11 16:22 ` [Qemu-devel] [PATCH 2/7] qapi: QMP input visitor, handle floats parsed as ints Luiz Capitulino
2012-05-11 17:04 ` Michael Roth
2012-05-11 17:16 ` Andreas Färber
2012-05-11 17:34 ` Michael Roth
2012-05-11 17:38 ` Luiz Capitulino [this message]
[not found] ` <1335558083-26196-5-git-send-email-mdroth@linux.vnet.ibm.com>
2012-05-11 16:34 ` [Qemu-devel] [PATCH 4/7] qapi: String visitor, use %f represenation for floats Luiz Capitulino
2012-05-11 17:32 ` Michael Roth
2012-05-11 17:47 ` Andreas Färber
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=20120511143836.7d050709@doriath.home \
--to=lcapitulino@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@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).