Skip to contentSkip to conversation

cluster/fence/fenced fd.h main.c recover.c

Cluster-devel [email protected] 1 participant 1 message Jan 29, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: lhh at sourceware.org 2007-01-29 19:55:06

Modified files:
fence/fenced : fd.h main.c recover.c

Log message:
Add manual override for fenced to RHEL4 branch; patch is a backport from HEAD branch; fixes 223060

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.5&r2=1.7.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.16.2.11&r2=1.16.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.8&r2=1.10.2.9

fence/fenced/fd.h +3 -0
@@ -52,6 +52,7 @@
 
 
 #define FENCED_SOCK_PATH "fenced_socket"
+#define DEFAULT_OVERRIDE_PATH	"/var/run/cluster/fenced_override"
 
 #define DEFAULT_POST_JOIN_DELAY   6
 #define DEFAULT_POST_FAIL_DELAY   0
@@ -129,10 +130,12 @@
 	int debug;
 	int post_join_delay;
 	int post_fail_delay;
+	char *override_path;
 	int8_t clean_start;
 	int8_t post_join_delay_opt;
 	int8_t post_fail_delay_opt;
 	int8_t clean_start_opt;
+	int8_t override_path_opt;
 };
 
 #define FDFL_RUN        (0)
fence/fenced/main.c +27 -1
@@ -23,7 +23,7 @@
 char our_name[MAX_CLUSTER_MEMBER_NAME_LEN+1];
 
 
-#define OPTION_STRING			("cj:f:t:Dn:hVSwQ")
+#define OPTION_STRING			("cj:f:t:Dn:O:hVSwQ")
 #define LOCKFILE_NAME			"/var/run/fenced.pid"
 
 
@@ -40,6 +40,8 @@
 			           DEFAULT_POST_JOIN_DELAY);
 	printf("  -f <secs>        Post-fail fencing delay (default %d)\n",
 				   DEFAULT_POST_FAIL_DELAY);
+ 	printf("  -O <path>        Override path (default %s)\n",
+ 	       			   DEFAULT_OVERRIDE_PATH);
 	printf("  -D               Enable debugging code and don't fork\n");
 	printf("  -h               Print this help, then exit\n");
 	printf("  -n <name>        Name of the fence domain, \"default\" if none\n");
@@ -434,6 +436,23 @@
 			free(str);
 	}
 
+	if (fd->comline->override_path_opt == FALSE) {
+		str = NULL;
+		memset(path, 0, 256);
+		sprintf(path, "/cluster/fence_daemon/@override_path");
+
+		error = ccs_get(cd, path, &str);
+		if (!error)
+			/* XXX These are not explicitly freed on exit; if
+			   we decide to make fenced handle SIGHUP at a later
+			   time, we will need to free this. */
+			fd->comline->override_path = strdup(str);
+		else
+			fd->comline->override_path = strdup(DEFAULT_OVERRIDE_PATH);
+		if (str)
+			free(str);
+	}
+
 	log_debug("delay post_join %ds post_fail %ds",
 		  fd->comline->post_join_delay, fd->comline->post_fail_delay);
 
@@ -527,6 +546,8 @@
 	int cont = TRUE;
 	int optchar;
 
+	comline->override_path_opt = FALSE;
+	comline->override_path = NULL;
 	comline->post_join_delay_opt = FALSE;
 	comline->post_fail_delay_opt = FALSE;
 	comline->clean_start_opt = FALSE;
@@ -551,6 +572,11 @@
 			comline->post_fail_delay_opt = TRUE;
 			break;
 
+		case 'O':
+			comline->override_path = strdup(optarg);
+			comline->override_path_opt = TRUE;
+			break;
+
 		case 'D':
 			comline->debug = TRUE;
 			fenced_debug = TRUE;
fence/fenced/recover.c +93 -2

119 lines not on this page · raw message