Re: [PATCH 1/6] votequorum: Return current ring id in callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK but for a small English fix to the manpage, shown inline

On 05/08/14 11:09, Jan Friesse wrote:
Returning ring id will be used in poll function.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
  cts/agents/votequorum_test_agent.c |    1 +
  exec/votequorum.c                  |    3 +++
  include/corosync/ipc_votequorum.h  |   14 ++++++++++++++
  include/corosync/votequorum.h      |    6 ++++++
  lib/votequorum.c                   |    3 +++
  man/votequorum_initialize.3.in     |    5 +++++
  test/testvotequorum1.c             |    3 +++
  7 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/cts/agents/votequorum_test_agent.c b/cts/agents/votequorum_test_agent.c
index e460f25..c61a4af 100644
--- a/cts/agents/votequorum_test_agent.c
+++ b/cts/agents/votequorum_test_agent.c
@@ -61,6 +61,7 @@ static void votequorum_notification_fn(
  	votequorum_handle_t handle,
  	uint64_t context,
  	uint32_t quorate,
+	votequorum_ring_id_t ring_id,
  	uint32_t node_list_entries,
  	votequorum_node_t node_list[])
  {
diff --git a/exec/votequorum.c b/exec/votequorum.c
index d365147..54b6fbe 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -49,6 +49,7 @@
  #include <corosync/logsys.h>
  #include <corosync/coroapi.h>
  #include <corosync/icmap.h>
+#include <corosync/votequorum.h>
  #include <corosync/ipc_votequorum.h>

  #include "service.h"
@@ -1677,6 +1678,8 @@ static int votequorum_exec_send_quorum_notification(void *conn, uint64_t context
  	res_lib_votequorum_notification = (struct res_lib_votequorum_notification *)&buf;
  	res_lib_votequorum_notification->quorate = cluster_is_quorate;
  	res_lib_votequorum_notification->node_list_entries = cluster_members;
+	res_lib_votequorum_notification->ring_id.nodeid = quorum_ringid.rep.nodeid;
+	res_lib_votequorum_notification->ring_id.seq = quorum_ringid.seq;
  	res_lib_votequorum_notification->context = context;
  	list_iterate(tmp, &cluster_members_list) {
  		node = list_entry(tmp, struct cluster_node, list);
diff --git a/include/corosync/ipc_votequorum.h b/include/corosync/ipc_votequorum.h
index c7bb3ed..0fdcd8b 100644
--- a/include/corosync/ipc_votequorum.h
+++ b/include/corosync/ipc_votequorum.h
@@ -61,6 +61,11 @@ enum res_votequorum_types {
  	MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
  };

+struct mar_votequorum_ring_id {
+	mar_uint32_t nodeid;
+	mar_uint64_t seq;
+};
+
  struct req_lib_votequorum_qdevice_register {
  	struct qb_ipc_request_header header __attribute__((aligned(8)));
  	char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
@@ -157,6 +162,7 @@ struct res_lib_votequorum_notification {
  	struct qb_ipc_response_header header __attribute__((aligned(8)));
  	mar_uint32_t quorate __attribute__((aligned(8)));
  	mar_uint64_t context __attribute__((aligned(8)));
+	struct mar_votequorum_ring_id ring_id __attribute__((aligned(8)));
  	mar_uint32_t node_list_entries __attribute__((aligned(8)));
  	struct votequorum_node node_list[] __attribute__((aligned(8)));
  };
@@ -167,4 +173,12 @@ struct res_lib_votequorum_expectedvotes_notification {
  	mar_uint32_t expected_votes __attribute__((aligned(8)));
  };

+static inline void marshall_from_mar_votequorum_ring_id (
+	votequorum_ring_id_t *dest,
+	const struct mar_votequorum_ring_id *src)
+{
+	dest->nodeid = src->nodeid;
+	dest->seq = src->seq;
+};
+
  #endif
diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h
index c85f281..bba964b 100644
--- a/include/corosync/votequorum.h
+++ b/include/corosync/votequorum.h
@@ -81,10 +81,16 @@ typedef struct {
  	uint32_t state;
  } votequorum_node_t;

+typedef struct {
+	uint32_t nodeid;
+	uint64_t seq;
+} votequorum_ring_id_t;
+
  typedef void (*votequorum_notification_fn_t) (
  	votequorum_handle_t handle,
  	uint64_t context,
  	uint32_t quorate,
+	votequorum_ring_id_t ring_id,
  	uint32_t node_list_entries,
  	votequorum_node_t node_list[]);

diff --git a/lib/votequorum.c b/lib/votequorum.c
index 56ac517..20843cf 100644
--- a/lib/votequorum.c
+++ b/lib/votequorum.c
@@ -438,6 +438,7 @@ cs_error_t votequorum_dispatch (
  	struct res_lib_votequorum_notification *res_lib_votequorum_notification;
  	struct res_lib_votequorum_expectedvotes_notification *res_lib_votequorum_expectedvotes_notification;
  	char dispatch_buf[IPC_DISPATCH_SIZE];
+	votequorum_ring_id_t ring_id;

  	if (dispatch_types != CS_DISPATCH_ONE &&
  		dispatch_types != CS_DISPATCH_ALL &&
@@ -507,10 +508,12 @@ cs_error_t votequorum_dispatch (
  				break;
  			}
  			res_lib_votequorum_notification = (struct res_lib_votequorum_notification *)dispatch_data;
+			marshall_from_mar_votequorum_ring_id (&ring_id, &res_lib_votequorum_notification->ring_id);

  			callbacks.votequorum_notify_fn ( handle,
  							 res_lib_votequorum_notification->context,
  							 res_lib_votequorum_notification->quorate,
+							 ring_id,
  							 res_lib_votequorum_notification->node_list_entries,
  							 (votequorum_node_t *)res_lib_votequorum_notification->node_list );
  				;
diff --git a/man/votequorum_initialize.3.in b/man/votequorum_initialize.3.in
index 64b78de..b74f964 100644
--- a/man/votequorum_initialize.3.in
+++ b/man/votequorum_initialize.3.in
@@ -64,6 +64,11 @@ typedef void (*votequorum_notification_fn_t) (
  	);

  .fi
+
+Current ring_id (one get in votequorum_notification_fn) have to be passed to

The current ring_id (...) must be passed to

+.B votequorum_qdevice_poll
+to make qdevice voting valid.
+
  .PP
  Every time the expected votes are changed, the callback is called.
  The expected votes callback function is described by the following type definitions:
diff --git a/test/testvotequorum1.c b/test/testvotequorum1.c
index 0e443c3..87547ae 100644
--- a/test/testvotequorum1.c
+++ b/test/testvotequorum1.c
@@ -35,6 +35,7 @@
  #include <config.h>

  #include <sys/types.h>
+#include <inttypes.h>
  #include <stdio.h>
  #include <string.h>
  #include <stdint.h>
@@ -79,6 +80,7 @@ static void votequorum_notification_fn(
  	votequorum_handle_t handle,
  	uint64_t context,
  	uint32_t quorate,
+	votequorum_ring_id_t ring_id,
  	uint32_t node_list_entries,
  	votequorum_node_t node_list[]
  	)
@@ -88,6 +90,7 @@ static void votequorum_notification_fn(
  	printf("votequorum notification called \n");
  	printf("  quorate         = %d\n", quorate);
  	printf("  number of nodes = %d\n", node_list_entries);
+	printf("  current ringid  = (%u.%"PRIu64")\n", ring_id.nodeid, ring_id.seq);

  	for (i = 0; i< node_list_entries; i++) {
  		printf("      %d: %s\n", node_list[i].nodeid, node_state(node_list[i].state));


_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux