cluster/cman cman_tool/cman_tool.h cman_tool/j ...
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: pcaulfield at sourceware.org 2007-11-29 11:19:12
Modified files:
cman/cman_tool : cman_tool.h join.c main.c
cman/daemon : ais.c cmanccs.c commands.c
cman/man : cman_tool.8
Log message:
Reinstate 'cman_tool join -X', allowing people to start a cluster without the hassle of a cluster.conf file. There are some caveats to this, which are mentioned in the man page.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/cman_tool.h.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/join.c.diff?cvsroot=cluster&r1=1.51&r2=1.52
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/main.c.diff?cvsroot=cluster&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/ais.c.diff?cvsroot=cluster&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/man/cman_tool.8.diff?cvsroot=cluster&r1=1.14&r2=1.15
cman/cman_tool/cman_tool.h +1 -0
@@ -98,6 +98,7 @@int wait_quorate_opt;int fence_opt;int addresses_opt; +int noccs_opt; };typedef struct commandline commandline_t ;
cman/cman_tool/join.c +11 -4
@@ -62,12 +62,15 @@int ctree;int p[2 ]; - ctree =ccs_force_connect (NULL ,1 ); -if (ctree <0 ) +if (!comline->noccs_opt) { -die ("ccsd is not running\n" ); + ctree =ccs_force_connect (NULL ,1 ); +if (ctree <0 ) + { +die ("ccsd is not running\n" ); + } +ccs_disconnect (ctree); } -ccs_disconnect (ctree);/* * If we can talk to cman then we're already joined (or joining);
@@ -114,6 +117,10 @@snprintf (scratch,sizeof (scratch),"CMAN_DEBUGLOG=%d" , comline->verbose); envp[envptr++] =strdup (scratch); } +if (comline->noccs_opt) { +snprintf (scratch,sizeof (scratch),"CMAN_NOCCS=TRUE" ); + envp[envptr++] =strdup (scratch); + }/* Use cman to configure services */ envp[envptr++] =strdup ("OPENAIS_DEFAULT_CONFIG_IFACE=cmanconfig" );
cman/cman_tool/main.c +124 -106
278 lines not on this page · raw message
cman/daemon/ais.c +15 -2
@@ -300,11 +300,17 @@P_AIS ("Adding local address %s\n" , ifaddr); -/* This will already exist as early config creates it */ global_objdb->object_find_reset (OBJECT_PARENT_HANDLE );if (global_objdb->object_find (OBJECT_PARENT_HANDLE , -"totem" ,strlen ("totem" ),&totem_object_handle) ==0 ) { +"totem" ,strlen ("totem" ), &totem_object_handle)) { + global_objdb->object_create (OBJECT_PARENT_HANDLE , &totem_object_handle, +"totem" ,strlen ("totem" )); + } + + global_objdb->object_find_reset (OBJECT_PARENT_HANDLE ); +if (global_objdb->object_find (OBJECT_PARENT_HANDLE , +"totem" ,strlen ("totem" ), &totem_object_handle) ==0 ) {if (global_objdb->object_create (totem_object_handle, &interface_object_handle,"interface" ,strlen ("interface" )) ==0 ) {
@@ -551,6 +557,13 @@ }/* Make sure mainconfig doesn't stomp on our logging options */ +if (global_objdb->object_find (OBJECT_PARENT_HANDLE , +"logging" ,strlen ("logging" ), &object_handle)) { + + global_objdb->object_create (OBJECT_PARENT_HANDLE , &object_handle, +"logging" ,strlen ("logging" )); + } + objdb->object_find_reset (OBJECT_PARENT_HANDLE ); if (objdb->object_find(OBJECT_PARENT_HANDLE, "logging", strlen("logging"),
cman/daemon/cmanccs.c +152 -70
322 lines not on this page · raw message
cman/daemon/commands.c +10 -19
@@ -382,9 +382,6 @@if (ais_running)return -EALREADY ; -if (nodeid <0 || nodeid >4096 ) -return -EINVAL ; - wanted_nodeid = nodeid;return 0 ; }
@@ -417,8 +414,8 @@ }time (&join_time); - us =add_new_node (nodename, wanted_nodeid,-1 , expected_votes, -NODESTATE_MEMBER ); + us =add_new_node (nodename, wanted_nodeid,1 , expected_votes, +NODESTATE_DEAD );set_port_bit (us,0 ); us->us =1 ;
@@ -1728,6 +1725,10 @@ msg->flags &= ~NODE_FLAGS_SEESDISALLOWED ; node =find_node_by_nodeid (nodeid); +if (!node) { +add_ais_node (nodeid, incarnation, num_ais_nodes); + node =find_node_by_nodeid (nodeid); + }assert (node);/* Newer nodes 6.1.0 onwards, set the DIRTY flag if they have state. If the new node has been down
@@ -1969,22 +1970,11 @@/* This really should exist!! */ if (!node) {char tempname[256 ]; - node =malloc (sizeof (struct cluster_node )); -if (!node) { -log_printf (LOG_ERR ,"error allocating node struct for id %d, but CCS doesn't know about it anyway\n" , - nodeid); -return ; - }log_printf (LOG_ERR ,"Got node from AIS id %d with no CCS entry\n" , nodeid); -memset (node,0 ,sizeof (struct cluster_node )); -node_add_ordered (node); - node->state =NODESTATE_DEAD ; - node->votes =1 ; -/* Emergency nodename */ -sprintf (tempname,"Node%d\n" , nodeid); - node->name =strdup (tempname); +sprintf (tempname,"Node%d" , nodeid); + node =add_new_node (tempname, nodeid,1 , total_members,NODESTATE_DEAD ); }if (node->state ==NODESTATE_DEAD ) {
@@ -2003,7 +1993,8 @@P_MEMB ("del_ais_node %d\n" , nodeid); node =find_node_by_nodeid (nodeid); -assert (node); +if (!node) +return ;/* If the node was fenced while up (ie independantly of fenced) then * don't clear the fenced flag. There is a timeout associated with
cman/man/cman_tool.8 +23 -0
@@ -232,6 +232,29 @@ is prepared to wait. If the operation times out then a status of 2 is returned. Note that just because cman_tool has given up, does not mean that cman itself has stopped trying to join a cluster. +.TP +.I -X +Tells cman not to use CCS to get cluster information. If you use this option then cman will +apply several defaults to the cluster to get it going. The cluster name will be +"RHCluster", node IDs will default to the IP address of the node and remote node +names will show up as Node<nodeid>. All of these, apart from the node names can +be overridded on the cman_tool command-line if required. +.br +If you have to set up fence devices, services or anything else in cluster.conf then +this option is probably not worthwhile to you - the extra readability of sensible node +names and numbers will make it worth using CCS for the cluster too. But for a simple +failover cluster this might save you some effort. +.br +On each node using this configuration you will need to have the same authorisation key +installed. To create this key run +.br +mkdir /etc/ais +.br +ais-keygen +.br +mv /etc/ais/authkey /etc/cluster/cman_authkey +.br +then copy that file to all nodes you want to join the cluster. .br .SH "NODES" OPTIONS .TP