summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@irqsave.net>2014-02-22 18:43:41 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-02-28 18:59:06 +0100
commit0c762736df0cce743b4017c41435632dcb866413 (patch)
tree68713972744b10523b47c058fcf38da0ef4d3e80 /block
parenta9e6a0cbe2c12c7b5708451d2211d9b00922d605 (diff)
downloadqemu-0c762736df0cce743b4017c41435632dcb866413.tar.gz
qmp: Make Quorum error events more palatable.
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> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/quorum.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/block/quorum.c b/block/quorum.c
index 6c28239718..bd997b7322 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -200,11 +200,14 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
{
QObject *data;
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)));
+ }
monitor_protocol_event(QEVENT_QUORUM_REPORT_BAD, data);
qobject_decref(data);
}