Reviewed-by: Jan Friesse <jfriesse@xxxxxxxxxx>
Fabio M. Di Nitto napsal(a):
From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>
Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
include/corosync/votequorum.h | 2 +-
lib/votequorum.c | 2 +-
man/votequorum_getinfo.3.in | 20 +++++++++++++++++++-
tools/corosync-quorumtool.c | 4 ++--
4 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h
index 98b7b76..76676ee 100644
--- a/include/corosync/votequorum.h
+++ b/include/corosync/votequorum.h
@@ -61,7 +61,7 @@ typedef uint64_t votequorum_handle_t;
struct votequorum_info {
unsigned int node_id;
- unsigned int state;
+ unsigned int node_state;
unsigned int node_votes;
unsigned int node_expected_votes;
unsigned int highest_expected;
diff --git a/lib/votequorum.c b/lib/votequorum.c
index 133e706..6240f99 100644
--- a/lib/votequorum.c
+++ b/lib/votequorum.c
@@ -174,7 +174,7 @@ cs_error_t votequorum_getinfo (
error = res_lib_votequorum_getinfo.header.error;
info->node_id = res_lib_votequorum_getinfo.nodeid;
- info->state = res_lib_votequorum_getinfo.state;
+ info->node_state = res_lib_votequorum_getinfo.state;
info->node_votes = res_lib_votequorum_getinfo.votes;
info->node_expected_votes = res_lib_votequorum_getinfo.expected_votes;
info->highest_expected = res_lib_votequorum_getinfo.highest_expected;
diff --git a/man/votequorum_getinfo.3.in b/man/votequorum_getinfo.3.in
index d50af49..4f36c2c 100644
--- a/man/votequorum_getinfo.3.in
+++ b/man/votequorum_getinfo.3.in
@@ -43,12 +43,17 @@ The
.B votequorum_getinfo
function is used to get information about the voting system and its nodes.
+The
+.I nodeid
+argument indicates which node information should be stored in the votequorum_info structure.
+
The votequorum_info structure is defined as follows:
.nf
struct votequorum_info {
unsigned int node_id;
+ unsigned int node_state;
unsigned int node_votes;
unsigned int node_expected_votes;
unsigned int highest_expected;
@@ -57,18 +62,31 @@ struct votequorum_info {
unsigned int flags;
};
+.fi
+The node_state is defined as:
+.nf
+
+#define NODESTATE_MEMBER 1
+#define NODESTATE_DEAD 2
+#define NODESTATE_LEAVING 3
+
+.fi
+The flags are defined as:
+.nf
+
#define VOTEQUORUM_INFO_FLAG_TWONODE 1
#define VOTEQUORUM_INFO_FLAG_QUORATE 2
#define VOTEQUORUM_INFO_WAIT_FOR_ALL 4
#define VOTEQUORUM_INFO_LAST_MAN_STANDING 8
#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16
#define VOTEQUORUM_INFO_LEAVE_REMOVE 32
+#define VOTEQUORUM_INFO_QDEVICE 64
.fi
.PP
The members starting node_ hold information specific to the requested nodeid, the other are
general to the voting system.
.SH RETURN VALUE
-This call returns the CS_OK value if successful, otherwise an error is returned.
+This call returns the CS_OK value if successful, otherwise a generic error is returned.
.PP
.SH ERRORS
@COMMONIPCERRORS@
diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c
index 60926dc..eb0e485 100644
--- a/tools/corosync-quorumtool.c
+++ b/tools/corosync-quorumtool.c
@@ -382,8 +382,8 @@ static int display_quorum_data(int is_quorate, uint32_t nodeid, int loop)
if ((err=votequorum_getinfo(v_handle, nodeid, &info)) == CS_OK) {
printf("Node votes: %d\n", info.node_votes);
- printf("Node state: %s\n", decode_state(info.state));
- if (info.state != NODESTATE_MEMBER) {
+ printf("Node state: %s\n", decode_state(info.node_state));
+ if (info.node_state != NODESTATE_MEMBER) {
return err;
}
printf("Expected votes: %d\n", info.node_expected_votes);
_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss