Re: problem with fencing

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

 



On Fri, 2005-08-05 at 10:21 -0500, Adam Manthei wrote:
> What's odd about that is that there should still
> be something in the logs listing the output of the first command. 

I just did a quick test, and confirmed that it won't produce an error
unless all of the fence devices for a node fail to fence the server.
Right now it treats inability to execute the fence script the same as if
the fence script failed to fence the node.   Also the failure condition
where the exec returns does not produce any output, so nothing gets
displayed (or sent to syslog).

The attached patch (diff against RHEL4) will produce an error message
when the exec fails with the error message. Also it display a message
when no output is produced by a fence agent, for a failed exec.

Thanks,
Eric
? fenced
? fenced_badagentfix.patch
Index: agent.c
===================================================================
RCS file: /cvs/cluster/cluster/fence/fenced/agent.c,v
retrieving revision 1.7.2.4
diff -u -r1.7.2.4 agent.c
--- agent.c	24 Feb 2005 07:06:09 -0000	1.7.2.4
+++ agent.c	5 Aug 2005 16:17:45 -0000
@@ -38,11 +38,13 @@
 static void display_agent_output(char *agent, int fd)
 {
 	char msg[512], buf[256];
+	int got_output=0;
 
 	memset(msg, 0, sizeof(msg));
 	memset(buf, 0, sizeof(buf));
 
 	while (read(fd, buf, sizeof(buf)-1) > 0) {
+		got_output=1;
 		snprintf(msg, 256, "agent \"%s\" reports: ", agent);
 		strcat(msg, buf);
 
@@ -52,6 +54,12 @@
 		memset(buf, 0, sizeof(buf));
 		memset(msg, 0, sizeof(msg));
 	}
+	
+	if(!got_output){
+		snprintf(msg,512,"agent \"%s\" did not produce any output, yet failed to fence the node.",agent);
+		printf("%s\n",msg);
+		syslog(LOG_ERR,msg);
+	}
 }
 
 static int run_agent(char *agent, char *args)
@@ -109,6 +117,9 @@
 		close(pw_fd);
 
 		execlp(agent, agent, NULL);
+
+		fprintf(stderr,"Failed to execute agent, error: %s.",strerror(errno));
+
 		exit(EXIT_FAILURE);
 	}
 
--

Linux-cluster@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux