qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Benoit Canet <benoit@irqsave.net>,
	stefanha@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH V2 2/3] qmp: Make Quorum error events more palatable.
Date: Fri, 21 Feb 2014 18:42:01 -0700	[thread overview]
Message-ID: <53080069.8080600@redhat.com> (raw)
In-Reply-To: <1393032048-17982-3-git-send-email-benoit.canet@irqsave.net>

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

On 02/21/2014 06:20 PM, Benoît Canet wrote:
> Insert quorum QMP events documentation alphabetically.
> 
> Also change the "ret" errno value by an optional "error" being an strerror(-ret)
> in the QUORUM_REPORT_BAD qmp event.
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---

>      assert(node_name);
> -    data = qobject_from_jsonf("{ 'ret': %d"
> -                              ", 'node-name': %s"
> +    data = qobject_from_jsonf("{ 'node-name': %s"
>                                ", 'sector-num': %" PRId64
>                                ", 'sectors-count': %d }",
> -                              ret, node_name, acb->sector_num, acb->nb_sectors);
> +                              node_name, acb->sector_num, acb->nb_sectors);
> +    if (ret < 0) {
> +        QDict *dict = qobject_to_qdict(data);
> +        qdict_put(dict, "error", qstring_from_str(strerror(-ret)));
> +    }

This puts it in dict, but never modifies data...

>      monitor_protocol_event(QEVENT_QUORUM_REPORT_BAD, data);

...but you send data, not dict, over the wire.

It might be easier to do something like...

char *str = NULL;
if (ret < 0)
    str = strerror(-ret);
data = qobject_from_jsonf("{ 'node-name': %s"
                          "%s%s%s"
                          ", 'sector-num': %" PRId64
                          ", 'sectors-cont': %d }",
                          node_name,
                          str ? ", 'error': \"" : "", str ? str : "",
                          str ? "\"" : "",
...);

-- 
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: 604 bytes --]

  reply	other threads:[~2014-02-22  1:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-22  1:20 [Qemu-devel] [PATCH V2 0/3] Fix some quorum nits after merge Benoît Canet
2014-02-22  1:20 ` [Qemu-devel] [PATCH V2 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
2014-02-22  1:20 ` [Qemu-devel] [PATCH V2 2/3] qmp: Make Quorum error events more palatable Benoît Canet
2014-02-22  1:42   ` Eric Blake [this message]
2014-02-22  2:09     ` Benoît Canet
2014-02-22  2:15       ` Eric Blake
2014-02-22  1:20 ` [Qemu-devel] [PATCH V2 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
2014-02-22  7:38   ` Fam Zheng
2014-02-22 11:58     ` Benoît Canet
2014-02-22 16:00       ` Fam Zheng

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=53080069.8080600@redhat.com \
    --to=eblake@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=benoit@irqsave.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).