This patch adds the definition VOTEQUORUM_NODEID_US to the library,
which is already implicitly zero.
It also adds VOTEQUORUM_NODEID_QDEVICE and makes the code that checks
for them more generic. This now allows you to change the number of votes
assigned to a quorum disk (for example)
Chrissie
Index: include/corosync/votequorum.h
===================================================================
--- include/corosync/votequorum.h (revision 2198)
+++ include/corosync/votequorum.h (working copy)
@@ -48,6 +48,9 @@
#define VOTEQUORUM_INFO_FLAG_TWONODE 4
#define VOTEQUORUM_INFO_FLAG_QUORATE 8
+#define VOTEQUORUM_NODEID_US 0
+#define VOTEQUORUM_NODEID_QDEVICE -1
+
#define NODESTATE_JOINING 1
#define NODESTATE_MEMBER 2
#define NODESTATE_DEAD 3
Index: services/votequorum.c
===================================================================
--- services/votequorum.c (revision 2198)
+++ services/votequorum.c (working copy)
@@ -92,6 +92,8 @@
#define NODE_FLAGS_REMOVED 64
#define NODE_FLAGS_US 128
+#define NODEID_US 0
+#define NODEID_QDEVICE -1
typedef enum { NODESTATE_JOINING=1, NODESTATE_MEMBER,
NODESTATE_DEAD, NODESTATE_LEAVING, NODESTATE_DISALLOWED } nodestate_t;
@@ -805,6 +807,12 @@
struct cluster_node *node;
struct list_head *tmp;
+ if (nodeid == NODEID_US)
+ return us;
+
+ if (nodeid == NODEID_QDEVICE)
+ return quorum_device;
+
list_iterate(tmp, &cluster_members_list) {
node = list_entry(tmp, struct cluster_node, list);
if (node->node_id == nodeid)
@@ -1126,13 +1134,7 @@
log_printf(LOGSYS_LEVEL_DEBUG, "got getinfo request on %p for node %d\n", conn, req_lib_votequorum_getinfo->nodeid);
- if (req_lib_votequorum_getinfo->nodeid) {
- node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid);
- }
- else {
- node = us;
- }
-
+ node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid);
if (node) {
struct cluster_node *iternode;
struct list_head *nodelist;
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais