[Cluster-devel] cluster cman/init.d/cman fence/fence_tool/Make ...

rpeterso at sourceware.org rpeterso at sourceware.org
Fri Oct 13 14:57:55 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso at sourceware.org	2006-10-13 14:57:55

Modified files:
	cman/init.d    : cman 
	fence/fence_tool: Makefile fence_tool.c 

Log message:
	This is for bugzilla 210162: fence_tool needs -w and -t options
	to wait for group membership.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/init.d/cman.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fence_tool/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fence_tool/fence_tool.c.diff?cvsroot=cluster&r1=1.22&r2=1.23

--- cluster/cman/init.d/cman	2006/10/04 20:32:05	1.23
+++ cluster/cman/init.d/cman	2006/10/13 14:57:55	1.24
@@ -34,7 +34,7 @@
 #     wait FENCED_START_TIMEOUT seconds before giving up and failing when
 #     fenced does not start.  If FENCED_START_TIMEOUT is zero, then
 #     wait indefinately for fenced to start.
-FENCED_START_TIMEOUT=120
+FENCED_START_TIMEOUT=300
 
 LOCK_FILE="/var/lock/subsys/cman"
 
@@ -115,7 +115,7 @@
 
 start_fence()
 {
-    errmsg=$( /sbin/fence_tool -w -j $FENCED_START_TIMEOUT join \
+    errmsg=$( /sbin/fence_tool -w -t $FENCED_START_TIMEOUT join \
 	     > /dev/null 2>&1 ) || return 1
     return 0
 }
@@ -246,7 +246,7 @@
 {
     if /sbin/pidof fenced &> /dev/null
     then
-	/sbin/fence_tool leave > /dev/null 2>&1
+	/sbin/fence_tool -w leave > /dev/null 2>&1
 	rtrn=$?
 	sleep 1 # A bit of time for fenced to exit
 	return $rtrn
--- cluster/fence/fence_tool/Makefile	2006/10/04 19:16:51	1.11
+++ cluster/fence/fence_tool/Makefile	2006/10/13 14:57:55	1.12
@@ -34,7 +34,7 @@
 
 all: ${TARGET}
 
-fence_tool: ${FENCE_TOOL_SRC:.c=.o}
+fence_tool: ${FENCE_TOOL_SRC:.c=.o} ${top_srcdir}/../group/lib/libgroup.a
 	${CC} ${CFLAGS} ${INCLUDE} ${FENCE_TOOL_SRC:.c=.o} ${LDFLAGS} ${LOADLIBES} ${LDLIBS} -o $@
 
 agent.c:
--- cluster/fence/fence_tool/fence_tool.c	2006/10/04 19:16:51	1.22
+++ cluster/fence/fence_tool/fence_tool.c	2006/10/13 14:57:55	1.23
@@ -57,7 +57,7 @@
 char *prog_name;
 int operation;
 int child_wait = FALSE;
-int fenced_start_timeout = 30;
+int fenced_start_timeout = 300; /* five minutes */
 
 static int get_int_arg(char argopt, char *arg)
 {
@@ -135,15 +135,16 @@
 	return gdata.member;
 }
 
-static int do_wait(void)
+static int do_wait(int joining)
 {
 	int i;
 
 	for (i=0; !fenced_start_timeout || i < fenced_start_timeout; i++) {
-		if (we_are_in_fence_domain())
+		if (we_are_in_fence_domain() == joining)
 			return 0;
 		if (!(i % 5))
-			printf("Waiting for fenced to join the fence group.\n");
+			printf("Waiting for fenced to %s the fence group.\n",
+				   (joining?"join":"leave"));
 		sleep(1);
 	}
 	printf("Error joining the fence group.\n");
@@ -178,7 +179,7 @@
 	/* printf("join result %d %s\n", rv, buf); */
 
 	if (child_wait)
-		do_wait();
+		do_wait(1);
 	close(fd);
 	return EXIT_SUCCESS;
 }
@@ -205,6 +206,8 @@
 	rv = read(fd, buf, sizeof(buf));
 
 	/* printf("leave result %d %s\n", rv, buf); */
+	if (child_wait)
+		do_wait(0);
 	close(fd);
 	return EXIT_SUCCESS;
 }




More information about the Cluster-devel mailing list