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
Subject: Re: [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable.
Date: Fri, 21 Feb 2014 17:17:24 -0700 [thread overview]
Message-ID: <5307EC94.9000106@redhat.com> (raw)
In-Reply-To: <1393027087-14420-3-git-send-email-benoit.canet@irqsave.net>
[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]
On 02/21/2014 04:58 PM, Benoît Canet wrote:
> Insert quorum QMP events documentation alphabetically.
>
> Also change the "ret" errno value by "error" being an strerror() in the
> QUORUM_REPORT_BAD qmp event.
>
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
> block/quorum.c | 5 ++--
> docs/qmp/qmp-events.txt | 72 +++++++++++++++++++++++-----------------------
> tests/qemu-iotests/081.out | 2 +-
> 3 files changed, 40 insertions(+), 39 deletions(-)
>
> diff --git a/block/quorum.c b/block/quorum.c
> index 6c28239..3ef8eaa 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -200,11 +200,12 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
> {
> QObject *data;
> assert(node_name);
> - data = qobject_from_jsonf("{ 'ret': %d"
> + data = qobject_from_jsonf("{ 'error': %s"
> ", 'node-name': %s"
> ", 'sector-num': %" PRId64
> ", 'sectors-count': %d }",
> - ret, node_name, acb->sector_num, acb->nb_sectors);
> + strerror(ret), node_name, acb->sector_num,
Is ret positive or negative? Our typical convention is to use -errno
values for return (since we prefer reporting errors as less than 0),
which may mean needing strerror(-ret) here.
Also, I'd suggest making 'error' optional, and only omit it when ret is
non-zero. Otherwise...
> +{ "event": "QUORUM_REPORT_BAD",
> + "data": { "error": "Success", "node-name": "1.raw", "sector-num": 345435,
we get these weird-looking "error": "Success" strings. Look at how
BLOCK_JOB_COMPLETED documents things - I'd just lift that full paragraph:
- "error": Error message (json-string, optional)
Only present on failure. This field contains a human-readable
error message. There are no semantics other than that
streaming
has failed and clients should not try to interpret the error
string.
(When we eventually add events into qapi-schema.json as a first-class
citizen, it will be listed as '*error':'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 --]
next prev parent reply other threads:[~2014-02-22 0:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 23:58 [Qemu-devel] [PATCH 0/3] Fix some quorum nits after merge Benoît Canet
2014-02-21 23:58 ` [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
2014-02-22 0:17 ` Eric Blake
2014-02-21 23:58 ` [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable Benoît Canet
2014-02-22 0:17 ` Eric Blake [this message]
2014-02-21 23:58 ` [Qemu-devel] [PATCH 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
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=5307EC94.9000106@redhat.com \
--to=eblake@redhat.com \
--cc=benoit.canet@irqsave.net \
--cc=benoit@irqsave.net \
--cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.