Skip to contentSkip to conversation

cluster/fence agents/manual/Makefile fenced/fd ...

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

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2007-01-22 23:15:54

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

Log message:
Simple manual override for fenced & example replacement for fence_ack_manual

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/manual/Makefile.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&r1=1.25&r2=1.26

fence/agents/manual/Makefile +6 -0
@@ -36,6 +36,12 @@
 fence_ack_manual: ack.o
 	${CC} -o $@ $^
 
+# Using manual override instead of the binary version.
+# (this version does not require any configuration params
+#  in cluster.conf, but fencing must fail first)
+#fence_ack_manual: fence_ack_manual.sh
+#	cp $@ $^
+
 ack.o: ack.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
fence/fenced/fd.h +3 -0
@@ -53,6 +53,7 @@
 #define DEFAULT_POST_JOIN_DELAY	6
 #define DEFAULT_POST_FAIL_DELAY	0
 #define DEFAULT_CLEAN_START	0
+#define DEFAULT_OVERRIDE_PATH	"/var/run/cluster/fenced_override"
 #define FENCED_SOCK_PATH	"fenced_socket"
 
 extern char			*prog_name;
@@ -131,10 +132,12 @@
 {
 	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
@@ -15,7 +15,7 @@
 #include "ccs.h"
 #include "copyright.cf"
 
-#define OPTION_STRING			("cj:f:Dn:hVSw")
+#define OPTION_STRING			("cj:f:Dn:O:hVSw")
 #define LOCKFILE_NAME			"/var/run/fenced.pid"
 
 struct client {
@@ -145,6 +145,23 @@
 			free(str);
 	}
 
+	if (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@a later
+			   time, we will need to free this. */
+			comline.override_path = strdup(str);
+		else
+			comline.override_path = strdup(DEFAULT_OVERRIDE_PATH);
+		if (str)
+			free(str);
+	}
+
 	log_debug("delay post_join %ds post_fail %ds",
 		  comline.post_join_delay, comline.post_fail_delay);
 
@@ -500,6 +517,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("  -V	       Print program version information, then exit\n");
@@ -547,6 +566,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;
@@ -571,6 +592,11 @@
 			comline->post_fail_delay_opt = TRUE;
 			break;
 
+		case 'O':
+			comline->override_path = strdup(optarg);
+			comline->override_path_opt = TRUE;
+			break;
+
 		case 'D':
 			daemon_debug_opt = TRUE;
 			break;
fence/fenced/recover.c +93 -1

118 lines not on this page · raw message