[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2 2/3] qmp: Make Quorum error events more palat
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH V2 2/3] qmp: Make Quorum error events more palatable. |
Date: |
Fri, 21 Feb 2014 18:42:01 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
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 <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature