[Linux-cluster] [PATCH 4.1/4] fence - Wait for the join complete event in fenced

Bastian Blank bastian at waldi.eu.org
Thu Feb 17 20:55:30 UTC 2005


This patch changes -w to get a timeout value and fixes the return value
in case of timeout.

Bastian

-- 
Wait!  You have not been prepared!
		-- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2
-------------- next part --------------
diff -urN -x CVS -x debian cvs-patch04-wait/fenced/fd.h cvs-patch041-wait-timeout/fenced/fd.h
--- cvs-patch04-wait/fenced/fd.h	2005-02-17 19:05:48.000000000 +0100
+++ cvs-patch041-wait-timeout/fenced/fd.h	2005-02-17 21:24:37.000000000 +0100
@@ -133,6 +133,7 @@
 	int post_join_delay;
 	int post_fail_delay;
 	int clean_start;
+	int wait;
 	bool post_join_delay_opt;
 	bool post_fail_delay_opt;
 	bool clean_start_opt;
diff -urN -x CVS -x debian cvs-patch04-wait/fenced/main.c cvs-patch041-wait-timeout/fenced/main.c
--- cvs-patch04-wait/fenced/main.c	2005-02-17 19:05:04.000000000 +0100
+++ cvs-patch041-wait-timeout/fenced/main.c	2005-02-17 21:52:08.000000000 +0100
@@ -24,7 +24,7 @@
 char our_name[MAX_CLUSTER_MEMBER_NAME_LEN+1];
 
 
-#define OPTION_STRING			("cj:f:Dn:hVSwQ")
+#define OPTION_STRING			("cj:f:Dn:hVSw:Q")
 #define LOCKFILE_NAME			"/var/run/fenced.pid"
 
 
@@ -537,6 +537,7 @@
 {
 	bool cont = true;
 	int optchar;
+        char *temp;
 
 	comline->post_join_delay_opt = false;
 	comline->post_fail_delay_opt = false;
@@ -558,7 +559,7 @@
 			break;
 
 		case 'f':
-			comline->post_fail_delay = atoi(optarg);
+			comline->post_fail_delay = strtol(optarg, &temp, 0);
 			comline->post_fail_delay_opt = true;
 			break;
 
@@ -572,6 +573,7 @@
 			break;
 
 		case 'w':
+			comline->wait = atoi(optarg);
 			comline->wait_opt = true;
 			break;
 
@@ -662,8 +664,8 @@
 				struct pollfd fds[] = {
 					{ fd->wait_fds[0], POLLIN, 0 }
 				};
-				int ret = poll(fds, 1, -1);
-				if (ret < 0)
+				int ret = poll(fds, 1, comline.wait * 1000);
+				if (ret <= 0)
 					return EXIT_FAILURE;
 			}
 			return EXIT_SUCCESS;
diff -urN -x CVS -x debian cvs-patch04-wait/fence_tool/fence_tool.c cvs-patch041-wait-timeout/fence_tool/fence_tool.c
--- cvs-patch04-wait/fence_tool/fence_tool.c	2005-02-17 18:41:39.000000000 +0100
+++ cvs-patch041-wait-timeout/fence_tool/fence_tool.c	2005-02-17 21:23:06.000000000 +0100
@@ -34,7 +34,7 @@
 #include "ccs.h"
 #include "copyright.cf"
 
-#define OPTION_STRING			("VhScj:f:DwQ")
+#define OPTION_STRING			("VhScj:f:Dw:Q")
 #define LOCKFILE_NAME                   "/var/run/fenced.pid"
 #define FENCED_SOCK_PATH                "fenced_socket"
 
@@ -373,7 +373,7 @@
 	printf("  -c               All nodes are in a clean state to start\n");
 	printf("  -j <secs>        Post-join fencing delay\n");
 	printf("  -f <secs>        Post-fail fencing delay\n");
-	printf("  -w               Wait for join to complete\n");
+	printf("  -w <secs>        Wait for join to complete\n");
 	printf("\n");
 }
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20050217/87fd5b04/attachment.sig>


More information about the Linux-cluster mailing list