[Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c

jparsons at sourceware.org jparsons at sourceware.org
Wed Jan 10 23:46:37 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	jparsons at sourceware.org	2007-01-10 23:46:37

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	bz222234

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8&r2=1.8.2.1

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/08/15 18:37:04	1.8
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/10 23:46:37	1.8.2.1
@@ -91,6 +91,7 @@
 	pid_t i_pid;
 	int i_config;
 	int i_verbose;
+	int i_lanplus;
 };
 
 
@@ -175,8 +176,13 @@
 	int x;
 
 	/* Store path */
-	snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
-		 ipmi->i_host);
+	if (ipmi->i_lanplus) {
+		snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", 
+				ipmi->i_ipmitool, ipmi->i_host);
+	} else {
+		snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
+				ipmi->i_host);
+	}
 
 	if (ipmi->i_user) {
 		snprintf(arg, sizeof(arg), " -U %s", ipmi->i_user);
@@ -456,7 +462,7 @@
  */
 static struct ipmi *
 ipmi_init(struct ipmi *i, char *host, char *authtype,
-	  char *user, char *password, int verbose)
+	  char *user, char *password, int lanplus, int verbose)
 {
 	const char *p;
 
@@ -526,6 +532,7 @@
 	i->i_pid = -1;
 	i->i_id = IPMIID;
 	i->i_verbose = verbose;
+	i->i_lanplus = lanplus;
 
 	return i;
 }
@@ -570,7 +577,7 @@
 	}
 
 	memset((void *)i, 0, sizeof(*i));
-	ipmi_init(i, NULL, NULL, NULL, NULL, 0);
+	ipmi_init(i, NULL, NULL, NULL, NULL, 0, 0);
 	return i;
 }
 
@@ -699,7 +706,7 @@
 		user = NULL;
 
 	/* IPMI auth type not supported on RHEL3 */
-	i = ipmi_init(i, host, NULL, user, passwd, 0);
+	i = ipmi_init(i, host, NULL, user, passwd, 0, 0);
 	if (!i)
 		return S_OOPS;
 	i->i_config = 1;
@@ -804,7 +811,7 @@
 		  char *passwd, size_t pwlen,
 		  char *user, size_t userlen,
 		  char *op, size_t oplen,
-		  int *verbose)
+		  int *lanplus, int *verbose)
 {
 	char in[256];
 	int line = 0;
@@ -860,6 +867,8 @@
 			else
 				user[0] = 0;
 
+		} else if (!strcasecmp(name, "lanplus")) {
+			(*lanplus) = 1;
 		} else if (!strcasecmp(name, "option") ||
 			   !strcasecmp(name, "operation") ||
 			   !strcasecmp(name, "action")) {
@@ -923,6 +932,7 @@
 	char passwd[64];
 	char user[64];
 	char op[64];
+	int lanplus=0;
 	int verbose=0;
 	char *pname = basename(argv[0]);
 	struct ipmi *i;
@@ -937,7 +947,7 @@
 		/*
 		   Parse command line options if any were specified
 		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:o:vV?hH")) != EOF) {
+		while ((opt = getopt(argc, argv, "A:a:i:l:p:Po:vV?hH")) != EOF) {
 			switch(opt) {
 			case 'A':
 				/* Auth type */
@@ -956,6 +966,9 @@
 				/* password */
 				strncpy(passwd, optarg, sizeof(passwd));
 				break;
+			case 'P':
+				lanplus = 1;
+				break;
 			case 'o':
 				/* Operation */
 				strncpy(op, optarg, sizeof(op));
@@ -982,7 +995,7 @@
 				      authtype, sizeof(authtype),
 				      passwd, sizeof(passwd),
 				      user, sizeof(user),
-				      op, sizeof(op), &verbose) != 0)
+				      op, sizeof(op), &lanplus, &verbose) != 0)
 			return 1;
 	}
 
@@ -1011,7 +1024,7 @@
 
 
 	/* Ok, set up the IPMI struct */
-	i = ipmi_init(NULL, ip, authtype, user, passwd, verbose);
+	i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose);
 	if (!i)
 		fail_exit("Failed to initialize\n");
 




More information about the Cluster-devel mailing list