[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V5 27/28] qapi event: convert QUORUM events
From: |
Wenchao Xia |
Subject: |
[Qemu-devel] [PATCH V5 27/28] qapi event: convert QUORUM events |
Date: |
Wed, 30 Apr 2014 21:27:01 -0700 |
Signed-off-by: Wenchao Xia <address@hidden>
---
block/quorum.c | 25 ++++++++-----------------
1 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/block/quorum.c b/block/quorum.c
index ecec3a5..5d1c3dc 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -17,6 +17,7 @@
#include <gnutls/crypto.h>
#include "block/block_int.h"
#include "qapi/qmp/qjson.h"
+#include "qapi-event.h"
#define HASH_LENGTH 32
@@ -198,32 +199,22 @@ static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s,
static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
{
- QObject *data;
- assert(node_name);
- data = qobject_from_jsonf("{ 'node-name': %s"
- ", 'sector-num': %" PRId64
- ", 'sectors-count': %d }",
- node_name, acb->sector_num, acb->nb_sectors);
+ const char *msg = NULL;
if (ret < 0) {
- QDict *dict = qobject_to_qdict(data);
- qdict_put(dict, "error", qstring_from_str(strerror(-ret)));
+ msg = strerror(-ret);
}
- monitor_protocol_event(QEVENT_QUORUM_REPORT_BAD, data);
- qobject_decref(data);
+ qapi_event_send_quorum_report_bad(!!msg, msg, node_name,
+ acb->sector_num, acb->nb_sectors, NULL);
}
static void quorum_report_failure(QuorumAIOCB *acb)
{
- QObject *data;
const char *reference = acb->common.bs->device_name[0] ?
acb->common.bs->device_name :
acb->common.bs->node_name;
- data = qobject_from_jsonf("{ 'reference': %s"
- ", 'sector-num': %" PRId64
- ", 'sectors-count': %d }",
- reference, acb->sector_num, acb->nb_sectors);
- monitor_protocol_event(QEVENT_QUORUM_FAILURE, data);
- qobject_decref(data);
+
+ qapi_event_send_quorum_failure(reference, acb->sector_num,
+ acb->nb_sectors, NULL);
}
static int quorum_vote_error(QuorumAIOCB *acb);
--
1.7.1
- [Qemu-devel] [PATCH V5 17/28] qapi event: convert DEVICE_DELETED, (continued)
- [Qemu-devel] [PATCH V5 17/28] qapi event: convert DEVICE_DELETED, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 18/28] qapi event: convert DEVICE_TRAY_MOVED, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 19/28] qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 20/28] qapi event: convert BLOCK_IMAGE_CORRUPTED, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 21/28] qapi event: convert other BLOCK_JOB events, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 22/28] qapi event: convert NIC_RX_FILTER_CHANGED, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 23/28] qapi event: convert VNC events, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 24/28] qapi event: convert SPICE events, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 25/28] qapi event: convert BALLOON_CHANGE, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 26/28] qapi event: convert GUEST_PANICKED, Wenchao Xia, 2014/05/01
- [Qemu-devel] [PATCH V5 27/28] qapi event: convert QUORUM events,
Wenchao Xia <=
- [Qemu-devel] [PATCH V5 28/28] qapi event: clean up, Wenchao Xia, 2014/05/01