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)



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2199 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Christine Caulfield 2009-05-22 08:02:10 +00:00
parent ae22983140
commit b8efcc007e
2 changed files with 12 additions and 7 deletions

View File

@ -48,6 +48,9 @@ typedef uint64_t votequorum_handle_t;
#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

View File

@ -92,6 +92,8 @@ enum quorum_message_req_types {
#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 @@ static struct cluster_node *find_node_by_nodeid(int nodeid)
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 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void *
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;