cluster/cman cman_tool/main.c daemon/ais.c dae ...
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: pcaulfield at sourceware.org 2006-10-05 07:48:33
Modified files:
cman/cman_tool : main.c
cman/daemon : ais.c ais.h cnxman-private.h cnxman-socket.h
commands.c
cman/lib : libcman.c libcman.h
Log message:
Add some extra semantics to CMAN to cope with openAIS rejoins. Basically, this adds an extra state to a node: AISONLY which is only cleared when cman receives a valid TRANSITION message from the node.
A TRANSITION message is deemed to be invalid if the join_time of the node has not been changed (this is the timestamp the daemon was started) and the node has since been down and is rejoining. cman_tool will show if this is the case for a cluster by displaying the DisallowedNodes flag in the "cman_tool status command".
If there are disallowed nodes in the cluster then the "cman_tool expected" command is disabled until those nodes have been removed.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/main.c.diff?cvsroot=cluster&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/ais.c.diff?cvsroot=cluster&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/ais.h.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-private.h.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-socket.h.diff?cvsroot=cluster&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.28&r2=1.29
cman/cman_tool/main.c +2 -0
@@ -232,6 +232,8 @@printf (" Shutdown" );if (einfo->ei_flags &CMAN_EXTRA_FLAG_ERROR )printf (" Error" ); +if (einfo->ei_flags &CMAN_EXTRA_FLAG_DISALLOWED ) +printf (" DisallowedNodes" );printf (" \n" );printf ("Ports Bound: " );
cman/daemon/ais.c +6 -2
@@ -57,6 +57,7 @@struct totem_ip_address ifaddrs[MAX_INTERFACES ];int num_interfaces;uint64_t incarnation; +int num_ais_nodes;static int config_run;static char errorstring[512 ];
@@ -411,12 +412,15 @@P_AIS ("confchg_fn called type = %d, seq=%lld\n" , configuration_type, ring_id->seq); incarnation = ring_id->seq; + num_ais_nodes = member_list_entries;/* Tell the cman membership layer */ for (i=0 ; i<left_list_entries; i++)del_ais_node (left_list[i]); -for (i=0 ; i<joined_list_entries; i++) -add_ais_node (joined_list[i], incarnation, member_list_entries); + +/* Joining nodes are only added after a valid TRANSITION message +* is received. +*/ /* Save the left list for later so we can do a consolidated confchg message */ if (configuration_type ==TOTEM_CONFIGURATION_TRANSITIONAL ) {
cman/daemon/ais.h +1 -0
@@ -25,3 +25,4 @@extern struct totem_ip_address mcast_addr[MAX_INTERFACES ];extern struct totem_ip_address ifaddrs[MAX_INTERFACES ];extern int num_interfaces; +extern int num_ais_nodes;
cman/daemon/cnxman-private.h +8 -1
@@ -81,6 +81,7 @@unsigned int config_version;unsigned int flags;uint64_t fence_time; +uint64_t join_time;char clustername[16 ];char fence_agent[]; };
@@ -142,7 +143,10 @@#define RECONFIG_PARAM_CONFIG_VERSION 3#define RECONFIG_PARAM_CCS 4 -#define NODE_FLAGS_GOTTRANSITION 1 +/* NODE_FLAGS_BEENDOWN - this node has been down. +NODE_FLAGS_FENCED - This node has been fenced since it last went down. +*/ +#define NODE_FLAGS_BEENDOWN 1#define NODE_FLAGS_FENCED 2#define NODE_FLAGS_FENCEDWHILEUP 4
@@ -161,6 +165,8 @@uint64_t fence_time;/* A time_t */ char *fence_agent; +uint64_t cman_join_time;/* A time_t */ +struct timeval last_hello;/* Only used for quorum devices */ unsigned int votes;
@@ -189,6 +195,7 @@/* Kill reasons */ #define CLUSTER_KILL_REJECTED 1#define CLUSTER_KILL_CMANTOOL 2 +#define CLUSTER_KILL_REJOIN 3#define MAX_ADDR_PRINTED_LEN (address_length*3 + 1)
cman/daemon/cnxman-socket.h +5 -4
@@ -113,7 +113,7 @@#define MSG_BCASTSELF 0x4000000typedef enum {NODESTATE_JOINING =1 ,NODESTATE_MEMBER , -NODESTATE_DEAD ,NODESTATE_LEAVING }nodestate_t ; +NODESTATE_DEAD ,NODESTATE_LEAVING ,NODESTATE_AISONLY }nodestate_t ;static const char CLIENT_SOCKNAME []="/var/run/cman_client" ;static const char ADMIN_SOCKNAME []="/var/run/cman_admin" ;
@@ -163,9 +163,10 @@ };/* Flags */ -#define CMAN_EXTRA_FLAG_2NODE 1 -#define CMAN_EXTRA_FLAG_ERROR 2 -#define CMAN_EXTRA_FLAG_SHUTDOWN 4 +#define CMAN_EXTRA_FLAG_2NODE 1 +#define CMAN_EXTRA_FLAG_ERROR 2 +#define CMAN_EXTRA_FLAG_SHUTDOWN 4 +#define CMAN_EXTRA_FLAG_UNCOUNTED 8struct cl_extra_info {int node_state;
cman/daemon/commands.c +60 -9
164 lines not on this page · raw message
cman/lib/libcman.c +61 -14
144 lines not on this page · raw message
cman/lib/libcman.h +10 -5
@@ -150,9 +150,10 @@*/ /* Flags in ei_flags */ -#define CMAN_EXTRA_FLAG_2NODE 1 -#define CMAN_EXTRA_FLAG_ERROR 2 -#define CMAN_EXTRA_FLAG_SHUTDOWN 4 +#define CMAN_EXTRA_FLAG_2NODE 1 +#define CMAN_EXTRA_FLAG_ERROR 2 +#define CMAN_EXTRA_FLAG_SHUTDOWN 4 +#define CMAN_EXTRA_FLAG_DISALLOWED 8 typedef struct cman_extra_info { int ei_node_state;
@@ -198,8 +199,8 @@int cman_finish (cman_handle_t handle);/* Update/retrieve the private data */ -int cman_set_private (cman_handle_t *h,void *privdata); -int cman_get_private (cman_handle_t *h,void **privdata); +int cman_setprivdata (cman_handle_t *h,void *privdata); +int cman_getprivdata (cman_handle_t *h,void **privdata);/* * Notification of membership change events. Note that these are sent after
@@ -259,6 +260,10 @@to determine how big your array needs to be */ int cman_get_nodes (cman_handle_t handle,int maxnodes,int *retnodes,cman_node_t *nodes); +/* Returns a list of nodes that are known to AIS but blocked from joining the CMAN +cluster because they rejoined with cluster without a cman_tool join */ +int cman_get_disallowed_nodes (cman_handle_t handle,int maxnodes,int *retnodes,cman_node_t *nodes); +/* * cman_get_node() can get node info by nodeid OR by name. If the first * char of node->cn_name is zero then the nodeid will be used, otherwise