[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] dlm_controld: add multi-home



This patch adds multi-home capability to dlm_controld. If a node has
more than one address then the DLM will be told about all of them,
rather than just the first as at present.

It is assumed that sctp will be used as a transport protocol in this
case, but dlm_controld does not force this. It might be more appropriate
to set this in conga, but I'm not sure.

Signed-Off-By: Patrick Caulfield <pcaulfie redhat com>
Index: group/dlm_controld/dlm_daemon.h
===================================================================
RCS file: /cvs/cluster/cluster/group/dlm_controld/dlm_daemon.h,v
retrieving revision 1.13
diff -u -p -r1.13 dlm_daemon.h
--- group/dlm_controld/dlm_daemon.h	17 Aug 2007 21:17:53 -0000	1.13
+++ group/dlm_controld/dlm_daemon.h	10 Dec 2007 15:12:45 -0000
@@ -56,6 +56,7 @@
 #define MAXCON		4
 #define MAXNAME		255
 #define MAX_NODES	256 /* should be same as MAX_GROUP_MEMBERS */
+#define MAX_NODE_ADDRESSES 4
 
 extern char *prog_name;
 extern int daemon_debug_opt;
Index: group/dlm_controld/member_cman.c
===================================================================
RCS file: /cvs/cluster/cluster/group/dlm_controld/member_cman.c,v
retrieving revision 1.8
diff -u -p -r1.8 member_cman.c
--- group/dlm_controld/member_cman.c	24 Jul 2007 18:15:43 -0000	1.8
+++ group/dlm_controld/member_cman.c	10 Dec 2007 15:12:45 -0000
@@ -68,7 +68,10 @@ char *nodeid2name(int nodeid)
 
 static void statechange(void)
 {
-	int i, rv;
+	int i, j, rv;
+	struct cman_node_address addrs[MAX_NODE_ADDRESSES];
+	int num_addrs;
+	struct cman_node_address *addrptr = addrs;
 
 	old_node_count = cman_node_count;
 	memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes));
@@ -96,14 +99,25 @@ static void statechange(void)
 		if (cman_nodes[i].cn_member &&
 		    !is_old_member(cman_nodes[i].cn_nodeid)) {
 
+			rv = cman_get_node_addrs(ch, cman_nodes[i].cn_nodeid,
+						 MAX_NODE_ADDRESSES,
+						 &num_addrs, addrs);
+			if (rv < 0) {
+				log_debug("cman_get_node_addrs failed, falling back to single-homed. ");
+				num_addrs = 1;
+				addrptr = &cman_nodes[i].cn_address;
+			}
+
 			log_debug("cman: node %d added",
 				  cman_nodes[i].cn_nodeid);
 
-			add_configfs_node(cman_nodes[i].cn_nodeid,
-					  cman_nodes[i].cn_address.cna_address,
-					  cman_nodes[i].cn_address.cna_addrlen,
-					  (cman_nodes[i].cn_nodeid ==
-					   our_nodeid));
+			for (j = 0; j < num_addrs; j++) {
+				add_configfs_node(cman_nodes[i].cn_nodeid,
+						  addrptr[j].cna_address,
+						  addrptr[j].cna_addrlen,
+						  (cman_nodes[i].cn_nodeid ==
+						   our_nodeid));
+			}
 		}
 	}
 }

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]