fence: master - libfence: add nodename to agent args (for unfence)

David Teigland teigland at fedoraproject.org
Mon Oct 12 19:24:05 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/fence.git?p=fence.git;a=commitdiff;h=f4a59315a43bfac94f58493feaeea9680c05b5d7
Commit:        f4a59315a43bfac94f58493feaeea9680c05b5d7
Parent:        be7540a18c2cbc1c4e7daf0dfb2be57a426c6d52
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Mon Oct 12 11:26:21 2009 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Mon Oct 12 14:23:49 2009 -0500

libfence: add nodename to agent args (for unfence)

Add nodename of victim to agent args if it is not set explicitly
as a per-node device arg.

Some agents in the past, and probably the future, will want the
nodename of the victim.  It's so simple to add automatically that
there's no reason not to always include it, and avoid requiring
people to sometimes duplicate the name in the fence section.

(same as previous commit but for unfence args)

Signed-off-by: David Teigland <teigland at redhat.com>
---
 fence/libfence/agent.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/fence/libfence/agent.c b/fence/libfence/agent.c
index d18c3a2..0749a52 100644
--- a/fence/libfence/agent.c
+++ b/fence/libfence/agent.c
@@ -414,7 +414,8 @@ int fence_node(char *victim, struct fence_log *log, int log_size,
 static int make_args_unfence(int cd, char *victim, int d,
 			     char *device, char **args_out)
 {
-	char path[PATH_MAX], *args, *str;
+	char path[PATH_MAX], arg[PATH_MAX];
+	char *args, *str;
 	int error, cnt = 0;
 
 	args = malloc(FENCE_AGENT_ARGS_MAX);
@@ -443,6 +444,14 @@ static int make_args_unfence(int cd, char *victim, int d,
 		free(str);
 	}
 
+	/* add nodename of victim to args */
+
+	if (!strstr(args, "nodename=")) {
+		memset(arg, 0, PATH_MAX);
+		snprintf(arg, PATH_MAX, "nodename=%s\n", victim);
+		strcat(args, arg);
+	}
+
 	/* device-specific args */
 
 	memset(path, 0, PATH_MAX);


More information about the cluster-commits mailing list