From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WH0Hd-0002Wq-Q3 for qemu-devel@nongnu.org; Fri, 21 Feb 2014 19:17:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WH0HZ-0000MO-AF for qemu-devel@nongnu.org; Fri, 21 Feb 2014 19:17:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WH0HZ-0000MK-2P for qemu-devel@nongnu.org; Fri, 21 Feb 2014 19:17:29 -0500 Message-ID: <5307EC94.9000106@redhat.com> Date: Fri, 21 Feb 2014 17:17:24 -0700 From: Eric Blake MIME-Version: 1.0 References: <1393027087-14420-1-git-send-email-benoit.canet@irqsave.net> <1393027087-14420-3-git-send-email-benoit.canet@irqsave.net> In-Reply-To: <1393027087-14420-3-git-send-email-benoit.canet@irqsave.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BdF2AA3qSmrVKb4m1TatnlGNUGU9d32JQ" Subject: Re: [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org Cc: kwolf@redhat.com, Benoit Canet , stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BdF2AA3qSmrVKb4m1TatnlGNUGU9d32JQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/21/2014 04:58 PM, Beno=C3=AEt Canet wrote: > Insert quorum QMP events documentation alphabetically. >=20 > Also change the "ret" errno value by "error" being an strerror() in the= > QUORUM_REPORT_BAD qmp event. >=20 > Signed-off-by: Benoit Canet > --- > block/quorum.c | 5 ++-- > docs/qmp/qmp-events.txt | 72 +++++++++++++++++++++++---------------= -------- > tests/qemu-iotests/081.out | 2 +- > 3 files changed, 40 insertions(+), 39 deletions(-) >=20 > 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, c= har *node_name, int ret) > { > QObject *data; > assert(node_name); > - data =3D qobject_from_jsonf("{ 'ret': %d" > + data =3D 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_nu= m, 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-reada= ble error message. There are no semantics other than that streaming has failed and clients should not try to interpret the erro= r string. (When we eventually add events into qapi-schema.json as a first-class citizen, it will be listed as '*error':'str') --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --BdF2AA3qSmrVKb4m1TatnlGNUGU9d32JQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTB+yUAAoJEKeha0olJ0NqCOoIAKR3syN3n0KYrfeS/ZsrQjyF XyQcnHTWqff266XYSEM2d43lCPzyxdD1o1MAj8W5dsZEdswDfwp7u66uDgFXkaBY G03zsIRz3Q3uxA6E6S/0hgjDDyNE1N9nFxDS5XgtVoWmGqSBkVmKJF8nz3/XyyMD 4DiTMoG2lt9YTfIvIVdDSVB8LqzMy5JMxsp58CrpxqB3YqL9ibeZlJ/28U1SxtSP KkXMJXUR5yvTc2o6gGWfE2ix3r2HJjXGBKw/wXnC71+dI7X7bMKwqroLN8+HK8N/ jwOpLqmmJ1pFyslI1AnWWBlrSuDHQrqhJ5Xhg/Ffs9KZmWTf4VnO4qZKc6JEJlo= =HS1T -----END PGP SIGNATURE----- --BdF2AA3qSmrVKb4m1TatnlGNUGU9d32JQ--