From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx> Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx> --- :100644 100644 c92274e... ab8ebae... M exec/votequorum.c :100644 100644 b3213b9... e148149... M include/corosync/ipc_votequorum.h :100644 100644 de4d55c... ba8b30c... M include/corosync/votequorum.h :100644 100644 e02d8a9... 4c4e349... M man/votequorum_getinfo.3.in :100644 100644 15a62c0... 0e443c3... M test/testvotequorum1.c :100644 100644 456963c... 1d2417b... M tools/corosync-quorumtool.c exec/votequorum.c | 14 ++++++++++++++ include/corosync/ipc_votequorum.h | 4 ++++ include/corosync/votequorum.h | 6 +++--- man/votequorum_getinfo.3.in | 10 +++++----- test/testvotequorum1.c | 7 +++++-- tools/corosync-quorumtool.c | 8 ++++---- 6 files changed, 35 insertions(+), 14 deletions(-) diff --git a/exec/votequorum.c b/exec/votequorum.c index c92274e..ab8ebae 100644 --- a/exec/votequorum.c +++ b/exec/votequorum.c @@ -2002,6 +2002,20 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void * total_votes += qdevice->votes; } + switch(node->state) { + case NODESTATE_MEMBER: + res_lib_votequorum_getinfo.state = VOTEQUORUM_NODESTATE_MEMBER; + break; + case NODESTATE_DEAD: + res_lib_votequorum_getinfo.state = VOTEQUORUM_NODESTATE_DEAD; + break; + case NODESTATE_LEAVING: + res_lib_votequorum_getinfo.state = VOTEQUORUM_NODESTATE_LEAVING; + break; + default: + res_lib_votequorum_getinfo.state = node->state; + break; + } res_lib_votequorum_getinfo.state = node->state; res_lib_votequorum_getinfo.votes = node->votes; res_lib_votequorum_getinfo.expected_votes = node->expected_votes; diff --git a/include/corosync/ipc_votequorum.h b/include/corosync/ipc_votequorum.h index b3213b9..e148149 100644 --- a/include/corosync/ipc_votequorum.h +++ b/include/corosync/ipc_votequorum.h @@ -127,6 +127,10 @@ struct res_lib_votequorum_status { #define VOTEQUORUM_INFO_QDEVICE_ALIVE 128 #define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE 256 +#define VOTEQUORUM_NODESTATE_MEMBER 1 +#define VOTEQUORUM_NODESTATE_DEAD 2 +#define VOTEQUORUM_NODESTATE_LEAVING 3 + struct res_lib_votequorum_getinfo { struct qb_ipc_response_header header __attribute__((aligned(8))); unsigned int nodeid; diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h index de4d55c..ba8b30c 100644 --- a/include/corosync/votequorum.h +++ b/include/corosync/votequorum.h @@ -55,9 +55,9 @@ typedef uint64_t votequorum_handle_t; #define VOTEQUORUM_NODEID_QDEVICE 0 #define VOTEQUORUM_MAX_QDEVICE_NAME_LEN 255 -#define NODESTATE_MEMBER 1 -#define NODESTATE_DEAD 2 -#define NODESTATE_LEAVING 3 +#define VOTEQUORUM_NODESTATE_MEMBER 1 +#define VOTEQUORUM_NODESTATE_DEAD 2 +#define VOTEQUORUM_NODESTATE_LEAVING 3 /** @} */ diff --git a/man/votequorum_getinfo.3.in b/man/votequorum_getinfo.3.in index e02d8a9..4c4e349 100644 --- a/man/votequorum_getinfo.3.in +++ b/man/votequorum_getinfo.3.in @@ -66,16 +66,16 @@ struct votequorum_info { The node_state is defined as: .nf -#define NODESTATE_MEMBER 1 -#define NODESTATE_DEAD 2 -#define NODESTATE_LEAVING 3 +#define VOTEQUORUM_NODESTATE_MEMBER 1 +#define VOTEQUORUM_NODESTATE_DEAD 2 +#define VOTEQUORUM_NODESTATE_LEAVING 3 .fi The flags are defined as: .nf -#define VOTEQUORUM_INFO_TWONODE 1 -#define VOTEQUORUM_INFO_QUORATE 2 +#define VOTEQUORUM_INFO_TWONODE 1 +#define VOTEQUORUM_INFO_QUORATE 2 #define VOTEQUORUM_INFO_WAIT_FOR_ALL 4 #define VOTEQUORUM_INFO_LAST_MAN_STANDING 8 #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16 diff --git a/test/testvotequorum1.c b/test/testvotequorum1.c index 15a62c0..0e443c3 100644 --- a/test/testvotequorum1.c +++ b/test/testvotequorum1.c @@ -48,12 +48,15 @@ static votequorum_handle_t g_handle; static const char *node_state(int state) { switch (state) { - case NODESTATE_MEMBER: + case VOTEQUORUM_NODESTATE_MEMBER: return "Member"; break; - case NODESTATE_DEAD: + case VOTEQUORUM_NODESTATE_DEAD: return "Dead"; break; + case VOTEQUORUM_NODESTATE_LEAVING: + return "Leaving"; + break; default: return "UNKNOWN"; break; diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c index 456963c..1d2417b 100644 --- a/tools/corosync-quorumtool.c +++ b/tools/corosync-quorumtool.c @@ -364,13 +364,13 @@ static void display_nodes_data(uint32_t nodeid, nodeid_format_t nodeid_format, n static const char *decode_state(int state) { switch(state) { - case NODESTATE_MEMBER: + case VOTEQUORUM_NODESTATE_MEMBER: return "Member"; break; - case NODESTATE_DEAD: + case VOTEQUORUM_NODESTATE_DEAD: return "Dead"; break; - case NODESTATE_LEAVING: + case VOTEQUORUM_NODESTATE_LEAVING: return "Leaving"; break; default: @@ -419,7 +419,7 @@ static int display_quorum_data(int is_quorate, uint32_t nodeid, goto out; } printf("%s\n", decode_state(info.node_state)); - if (info.node_state != NODESTATE_MEMBER) { + if (info.node_state != VOTEQUORUM_NODESTATE_MEMBER) { goto out; } printf("Node votes: %d\n", info.node_votes); -- 1.7.7.6 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss