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

[Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rohara sourceware org	2006-07-10 17:02:43

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

Log message:
	Added "self" parameter as a way to pass our_name to the agent.
	
	This is needed for SCSI persistent reservation (fence_scsi).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/agent.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&r1=1.23&r2=1.24

--- cluster/fence/fenced/agent.c	2006/05/09 19:47:40	1.14
+++ cluster/fence/fenced/agent.c	2006/07/10 17:02:43	1.15
@@ -129,8 +129,9 @@
 	return -1;
 }
 
-static int make_args(int cd, char *victim, char *method, int d, char *device,
-		     char **args_out) {
+static int make_args(int cd, char *victim, char *self, char *method, int d,
+		     char *device, char **args_out)
+{
 	char path[256], *args, *str;
 	int error;
 
@@ -179,6 +180,13 @@
 		free(str);
 	}
 
+	if (self != NULL) {
+		memset(path, 0, 256);
+		sprintf(path, "self=%s", self);
+		strcat(args, path);
+		strcat(args, "\n");
+	}
+
 	if (error) {
 		free(args);
 		args = NULL;
@@ -252,7 +260,8 @@
 	return i;
 }
 
-static int use_device(int cd, char *victim, char *method, int d, char *device)
+static int use_device(int cd, char *victim, char *self,char *method, int d,
+		      char *device)
 {
 	char path[256], *agent, *args = NULL;
 	int error;
@@ -264,7 +273,7 @@
 	if (error)
 		goto out;
 
-	error = make_args(cd, victim, method, d, device, &args);
+	error = make_args(cd, victim, self, method, d, device, &args);
 	if (error)
 		goto out_agent;
 
@@ -300,7 +309,7 @@
 	cman_finish(ch);
 }
 
-int dispatch_fence_agent(int cd, char *victim)
+int dispatch_fence_agent(int cd, char *victim, char *self)
 {
 	char *method = NULL, *device = NULL;
 	int num_methods, num_devices, m, d, error = -1;
@@ -323,7 +332,7 @@
 			if (error)
 				break;
 
-			error = use_device(cd, victim, method, d, device);
+			error = use_device(cd, victim, self, method, d, device);
 			if (error)
 				break;
 
--- cluster/fence/fenced/fd.h	2006/06/20 18:11:58	1.21
+++ cluster/fence/fenced/fd.h	2006/07/10 17:02:43	1.22
@@ -173,7 +173,7 @@
 void do_recovery_done(fd_t *fd);
 
 /* agent.c */
-int dispatch_fence_agent(int cd, char *victim);
+int dispatch_fence_agent(int cd, char *victim, char *self);
 
 /* group.c */
 int setup_groupd(void);
--- cluster/fence/fenced/recover.c	2006/06/20 18:11:58	1.23
+++ cluster/fence/fenced/recover.c	2006/07/10 17:02:43	1.24
@@ -16,6 +16,7 @@
 
 extern int our_nodeid;
 extern commandline_t comline;
+extern char *our_name;
 
 /* Fencing recovery algorithm
 
@@ -309,7 +310,7 @@
 		log_debug("fencing node %s", node->name);
 		syslog(LOG_INFO, "fencing node \"%s\"", node->name);
 
-		error = dispatch_fence_agent(cd, node->name);
+		error = dispatch_fence_agent(cd, node->name, our_name);
 
 		syslog(LOG_INFO, "fence \"%s\" %s", node->name,
 		       error ? "failed" : "success");


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