cluster: STABLE3 - libfence: add nodename to agent args

David Teigland teigland at fedoraproject.org
Mon Oct 12 16:02:23 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=70fc3796c47e7185604570fe767c1e4e38bacc84
Commit:        70fc3796c47e7185604570fe767c1e4e38bacc84
Parent:        a81abbe637251f46a9730ca5f4a2b1db6194edab
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Mon Oct 12 10:56:51 2009 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Mon Oct 12 10:56:51 2009 -0500

libfence: add nodename to agent args

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.

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 49e6795..b199a6b 100644
--- a/fence/libfence/agent.c
+++ b/fence/libfence/agent.c
@@ -113,7 +113,8 @@ static int run_agent(char *agent, char *args, int *agent_result)
 static int make_args(int cd, char *victim, char *method, 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);
@@ -142,6 +143,14 @@ static int make_args(int cd, char *victim, char *method, 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