rpms/cluster/devel cluster-stable3-head.diff, NONE, 1.1 cluster.spec, 1.37, 1.38

Fabio M. Di Nitto fabbione at fedoraproject.org
Thu Feb 19 09:01:41 UTC 2009


Author: fabbione

Update of /cvs/pkgs/rpms/cluster/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30935

Modified Files:
	cluster.spec 
Added Files:
	cluster-stable3-head.diff 
Log Message:
Update for new corosync/openais and import fixes from STABLE3 branch


cluster-stable3-head.diff:

--- NEW FILE cluster-stable3-head.diff ---
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index b6e366d..50a8f05 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -256,7 +256,7 @@ static void show_status(void)
 	node.cn_name[0] = 0;
 	if (cman_get_node(h, CMAN_NODEID_US, &node) == 0) {
 		printf("Node name: %s\n", node.cn_name);
-		printf("Node ID: %d\n", node.cn_nodeid);
+		printf("Node ID: %u\n", node.cn_nodeid);
 	}
 
 	printf("Multicast addresses: ");
@@ -348,7 +348,7 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 	struct cman_node_address addrs[MAX_INTERFACES];
 	char jstring[1024];
 	int i,j,k;
-	int tmpid;
+	unsigned int tmpid;
 	cman_node_extra_t enode;
 
 	if (comline->num_nodenames > 0) {
@@ -375,8 +375,8 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 	/* Make the name more friendly if cman can't find it in cluster.conf
 	 *  (we really don't want corosync to look up names in DNS so it invents them)
 	 */
-	if (sscanf(node->cn_name, "Node%d", &tmpid) == 1 && tmpid == node->cn_nodeid) {
-		if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs)) {
+	if (sscanf(node->cn_name, "Node%u", &tmpid) == 1 && tmpid == node->cn_nodeid) {
+		if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs) && numaddrs) {
 			getnameinfo((struct sockaddr *)addrs[0].cna_address, addrs[0].cna_addrlen, node->cn_name, sizeof(node->cn_name), NULL, 0, NI_NAMEREQD);
 		}
 	}
@@ -388,7 +388,7 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 		strcpy(jstring, "                   ");
 
 	if (!comline->format_opts) {
-		printf("%4d   %c  %5d   %s  %s\n",
+		printf("%4u   %c  %5d   %s  %s\n",
 		       node->cn_nodeid, member_type,
 		       node->cn_incarnation, jstring, node->cn_name);
 	}
@@ -433,7 +433,7 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 			case FMT_NONE:
 				break;
 			case FMT_ID:
-				printf("%d ", node->cn_nodeid);
+				printf("%u ", node->cn_nodeid);
 				break;
 			case FMT_NAME:
 				printf("%s ", node->cn_name);
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index d518e6d..c1e7d1b 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -774,18 +774,17 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
 	}
 
 
-	/* Don't run under user "ais" */
+	/* Make sure we allow connections from user/group "ais" */
 	objdb->object_find_create(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &find_handle);
 	if (objdb->object_find_next(find_handle, &object_handle) != 0) {
 		objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
 					"aisexec", strlen("aisexec"));
-
 	}
 	objdb->object_find_destroy(find_handle);
 	objdb->object_key_create(object_handle, "user", strlen("user"),
-				    "root", strlen("root") + 1);
+				    "ais", strlen("ais") + 1);
 	objdb->object_key_create(object_handle, "group", strlen("group"),
-				    "root", strlen("root") + 1);
+				    "ais", strlen("ais") + 1);
 
 	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
 	if (objdb->object_find_next(find_handle, &object_handle) == 0)
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 490607d..5da3af3 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -1881,7 +1881,7 @@ static void do_process_transition(int nodeid, char *data)
 	/* Newer nodes 6.1.0 onwards, set the DIRTY flag if they have state. If the new node has been down
 	   and has state then we mark it disallowed because we cannot merge stateful nodes */
 	if ( (msg->flags & NODE_FLAGS_DIRTY && (node->flags & NODE_FLAGS_BEENDOWN)) ||
-	     (msg->flags & NODE_FLAGS_DIRTY && msg->first_trans && !node->us)) {
+	     (msg->flags & NODE_FLAGS_DIRTY && msg->first_trans && !node->us && (us->flags & NODE_FLAGS_DIRTY))) {
 		/* Don't duplicate messages */
 		if (node->state != NODESTATE_AISONLY) {
 			if (cluster_is_quorate) {
diff --git a/cman/daemon/logging.c b/cman/daemon/logging.c
index ad3359f..c18e40f 100644
--- a/cman/daemon/logging.c
+++ b/cman/daemon/logging.c
@@ -21,5 +21,9 @@ int subsys_mask = 0;
 
 void set_debuglog(int subsystems)
 {
+	if (subsystems)
+		logsys_config_subsys_set(CMAN_NAME, 0, LOG_LEVEL_DEBUG);
+	else
+		logsys_config_subsys_set(CMAN_NAME, 0, LOG_LEVEL_INFO);
 	subsys_mask = subsystems;
 }
diff --git a/cman/notifyd/main.c b/cman/notifyd/main.c
index 6aae796..7722032 100644
--- a/cman/notifyd/main.c
+++ b/cman/notifyd/main.c
@@ -10,6 +10,7 @@
 #include <sched.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/select.h>
 
 #include <libcman.h>
 #include <ccs.h>
@@ -334,25 +335,37 @@ out:
 
 static void loop()
 {
-	int rv;
-
-	for (;;) {
-		rv = cman_dispatch(cman_handle, CMAN_DISPATCH_ONE);
-		if (rv == -1 && errno == EHOSTDOWN) {
+	int cd_result, se_result;
+	fd_set read_fds;
+	int cman_fd;
+
+	do {
+		FD_ZERO (&read_fds);
+		cman_fd = cman_get_fd(cman_handle);
+		FD_SET (cman_fd, &read_fds);
+		se_result = select((cman_fd + 1), &read_fds, 0, 0, 0);
+		if (se_result == -1) {
+			logt_print(LOG_CRIT, "Unable to select on cman_fd: %s\n", strerror(errno));
 			byebye_cman();
-			logt_print(LOG_DEBUG, "waiting for cman to reappear..\n");
-			setup_cman(1);
-			logt_print(LOG_DEBUG, "cman is back..\n");
+			exit(EXIT_FAILURE);
 		}
 
-		if (daemon_quit) {
-			logt_print(LOG_DEBUG, "shutting down...\n");
-			byebye_cman();
-			exit(EXIT_SUCCESS);
+		if (FD_ISSET(cman_fd, &read_fds)) {
+			cd_result = 1;
+			while (cd_result > 0) {
+				cd_result = cman_dispatch(cman_handle, CMAN_DISPATCH_ONE);
+				if (cd_result == -1 && errno == EHOSTDOWN) {
+					byebye_cman();
+					logt_print(LOG_DEBUG, "waiting for cman to reappear..\n");
+					setup_cman(1);
+					logt_print(LOG_DEBUG, "cman is back..\n");
+				}
+			}
 		}
+	} while (se_result && !daemon_quit);
 
-		sleep(1);
-	}
+	logt_print(LOG_DEBUG, "shutting down...\n");
+	byebye_cman();
 }
 
 int main(int argc, char **argv)
diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index 4456e53..39acb31 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -97,7 +97,7 @@ static void flush_dev_cache(struct devlisthead *devlisthead)
 static struct devnode *alloc_list_obj(struct devlisthead *devlisthead, int maj,
 				      int min)
 {
-	struct devnode *nextnode, *startnode;
+	struct devnode *nextnode;
 
 	nextnode = malloc(sizeof(struct devnode));
 	if (!nextnode)
@@ -105,22 +105,17 @@ static struct devnode *alloc_list_obj(struct devlisthead *devlisthead, int maj,
 
 	memset(nextnode, 0, sizeof(struct devnode));
 
-	if (!devlisthead->devnode) {
-		devlisthead->devnode = startnode = nextnode;
-	} else {
-		startnode = devlisthead->devnode;
-		while (startnode->next)
-			startnode = startnode->next;
+	if (!devlisthead->devnode)
+		devlisthead->devnode = nextnode;
+	else
+		devlisthead->tail->next = nextnode;
 
-		/* always append what we find */
-		startnode->next = nextnode;
-		startnode = nextnode;
-	}
+	devlisthead->tail = nextnode;
 
-	startnode->maj = maj;
-	startnode->min = min;
+	nextnode->maj = maj;
+	nextnode->min = min;
 
-	return startnode;
+	return nextnode;
 }
 
 /* really annoying but we have no way to know upfront how
@@ -317,14 +312,14 @@ static int scanmdstat(struct devlisthead *devlisthead)
 	while (fgets(line, sizeof(line), fp) != NULL) {
 
 		/* i like things to be absolutely clean */
-		memset(device, 0, 16);
-		memset(separator, 0, 4);
-		memset(status, 0, 16);
-		memset(personality, 0, 16);
-		memset(firstdevice, 0, 16);
-		memset(devices, 0, 4096);
-
-		if (strlen(line) > 4096)
+		memset(device, 0, sizeof(device));
+		memset(separator, 0, sizeof(separator));
+		memset(status, 0, sizeof(status));
+		memset(personality, 0, sizeof(personality));
+		memset(firstdevice, 0, sizeof(firstdevice));
+		memset(devices, 0, sizeof(devices));
+
+		if (strlen(line) > sizeof(line))
 			continue;
 
 		/* we only parse stuff that starts with ^md
@@ -399,10 +394,10 @@ static int scanmapper(struct devlisthead *devlisthead)
 		return 0;
 
 	while (fgets(line, sizeof(line), fp) != NULL) {
-		memset(major, 0, 4);
-		memset(device, 0, 64);
+		memset(major, 0, sizeof(major));
+		memset(device, 0, sizeof(device));
 
-		if (strlen(line) > 4096)
+		if (strlen(line) > sizeof(line))
 			continue;
 
 		if (!strncmp(line, "Block devices:", 13)) {
@@ -626,10 +621,10 @@ static int sysfs_is_disk(char *path)
  * -1 on generic error
  * -2 -ENOMEM
  */
-static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
+static int scansysfs(struct devlisthead *devlisthead, char *path, int level, int parent_holder)
 {
 	struct devnode *startnode;
-	int i, n, maj, min;
+	int i, n, maj, min, has_holder = 0;
 	struct dirent **namelist;
 	struct stat sb;
 	char newpath[MAXPATHLEN];
@@ -643,39 +638,47 @@ static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
 			snprintf(newpath, sizeof(newpath),
 				 "%s/%s", path, namelist[n]->d_name);
 
-			if (!stat(newpath, &sb) && !level)
-				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath, 1) < 0)
-						return -1;
-
-			if (!lstat(newpath, &sb)) {
-				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath, 1) < 0)
-						return -1;
-
+			if (!lstat(newpath, &sb) && level)
 				if (S_ISLNK(sb.st_mode))
 					continue;
 
-				if (sysfs_is_dev(newpath, &maj, &min) > 0) {
-					startnode =
-					    alloc_list_obj(devlisthead, maj,
-							   min);
-					if (!startnode)
-						return -2;
+			if (sysfs_is_dev(newpath, &maj, &min) > 0) {
+				startnode =
+				    alloc_list_obj(devlisthead, maj,
+						   min);
+				if (!startnode)
+					return -2;
+
+				startnode->sysfsattrs.sysfs = 1;
+				startnode->sysfsattrs.removable =
+				    sysfs_is_removable(newpath);
 
-					startnode->sysfsattrs.sysfs = 1;
-					startnode->sysfsattrs.removable =
-					    sysfs_is_removable(newpath);
+				if (!parent_holder)
+					has_holder =
 					startnode->sysfsattrs.holders =
 					    sysfs_has_subdirs_entries(newpath,
 								      "holders");
-					startnode->sysfsattrs.slaves =
-					    sysfs_has_subdirs_entries(newpath,
-								      "slaves");
-					startnode->sysfsattrs.disk =
-					    sysfs_is_disk(newpath);
-				}
+				else
+					has_holder =
+					startnode->sysfsattrs.holders = parent_holder;
+
+				startnode->sysfsattrs.slaves =
+				    sysfs_has_subdirs_entries(newpath,
+							      "slaves");
+				startnode->sysfsattrs.disk =
+				    sysfs_is_disk(newpath);
 			}
+
+			if (!stat(newpath, &sb) && !level)
+				if (S_ISDIR(sb.st_mode))
+					if (scansysfs(devlisthead, newpath, 1, has_holder) < 0)
+						return -1;
+
+			if (!lstat(newpath, &sb))
+				if (S_ISDIR(sb.st_mode))
+					if (scansysfs(devlisthead, newpath, 1, has_holder) < 0)
+						return -1;
+
 		}
 		free(namelist[n]);
 	}
@@ -724,7 +727,7 @@ struct devlisthead *scan_for_dev(struct devlisthead *devlisthead,
 	/* it's important we check those 3 errors and abort in case
 	 * as it means that we are running out of mem,
 	 */
-	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0);
+	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0, 0);
 	if (res < -1)
 		goto emergencyout;
 
diff --git a/cman/qdisk/scandisk.h b/cman/qdisk/scandisk.h
index 6a8aa32..394d153 100644
--- a/cman/qdisk/scandisk.h
+++ b/cman/qdisk/scandisk.h
@@ -63,6 +63,8 @@ struct devnode {
 /* each entry can be 0 if we can't scan or < 0 if there are errors */
 
 struct devlisthead {
+	struct devnode *devnode;	/* points to the first entry */
+	struct devnode *tail;	/* last entry (for fast append) */
 	time_t cache_timestamp;	/* this cache timestamp */
 	int cache_timeout;	/* for how long this cache is valid */
 	int sysfs;		/* set to 1 if we were able to scan
@@ -74,7 +76,6 @@ struct devlisthead {
 				 * /proc/mdstat */
 	int mapper;		/* set to 1 if we were able to run
 				 * something against mapper */
-	struct devnode *devnode;	/* points to the first entry */
 };
 
 typedef void (*devfilter) (struct devnode * cur, void *arg);
diff --git a/dlm/tests/usertest/dlmtest2.c b/dlm/tests/usertest/dlmtest2.c
index da63b93..96e6a16 100644
--- a/dlm/tests/usertest/dlmtest2.c
+++ b/dlm/tests/usertest/dlmtest2.c
@@ -44,7 +44,6 @@ static int stress_lock_only = 0;
 static int openclose_ls = 0;
 static uint64_t our_xid;
 static char cmd[32];
-static int opt_cmd = 0;
 
 static unsigned int sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, sts_eagain, sts_other, sts_zero;
 static unsigned int bast_unlock, bast_skip;
@@ -1020,10 +1019,8 @@ static void process_command(int *quit)
 	char inbuf[132];
 	int x = 0, y = 0;
 
-	if (!opt_cmd) {
-		fgets(inbuf, sizeof(inbuf), stdin);
-		sscanf(inbuf, "%s %d %d", cmd, &x, &y);
-	}
+	fgets(inbuf, sizeof(inbuf), stdin);
+	sscanf(inbuf, "%s %d %d", cmd, &x, &y);
 
 	if (!strncmp(cmd, "EXIT", 4)) {
 		*quit = 1;
@@ -1260,7 +1257,7 @@ static void decode_arguments(int argc, char **argv)
 	int optchar;
 
 	while (cont) {
-		optchar = getopt(argc, argv, "n:r:c:i:thVoq:v:");
+		optchar = getopt(argc, argv, "n:r:i:thVoq:v:");
 
 		switch (optchar) {
 
@@ -1272,11 +1269,6 @@ static void decode_arguments(int argc, char **argv)
 			maxr = atoi(optarg);
 			break;
 
-		case 'c':
-			strcpy(cmd, optarg);
-			opt_cmd = 1;
-			break;
-
 		case 'i':
 			iterations = atoi(optarg);
 			break;
@@ -1413,11 +1405,6 @@ int main(int argc, char *argv[])
 
 	client_add(libdlm_fd, &maxi);
 
-	if (cmd) {
-		process_command(&quit);
-		goto out;
-	}
-
 	client_add(STDIN_FILENO, &maxi);
 
 	printf("Type EXIT to finish, help for usage\n");
diff --git a/fence/agents/ipmilan/expect.c b/fence/agents/ipmilan/expect.c
index fa85bd8..85ba487 100644
--- a/fence/agents/ipmilan/expect.c
+++ b/fence/agents/ipmilan/expect.c
@@ -68,7 +68,7 @@ ExpectToken(int	fd, struct Etoken * toklist, int to_secs, char * buf
 	clock_t		ticks;
 	int		nchars = 1; /* reserve space for an EOS */
 	struct timeval	tv;
-
+	struct tms      tms_unused; /*This tms is unused, but cygwin doesn't like NULL in times*/
 	struct Etoken *	this;
 
 	/* Figure out when to give up.  Handle lbolt wraparound */
@@ -77,7 +77,7 @@ ExpectToken(int	fd, struct Etoken * toklist, int to_secs, char * buf
 		return -1;
 	}
 	
-	starttime = times(NULL);
+	starttime = times(&tms_unused);
 	ticks = (to_secs*CLOCKS_PER_SEC);
 	endtime = starttime + ticks;
 
@@ -94,7 +94,7 @@ ExpectToken(int	fd, struct Etoken * toklist, int to_secs, char * buf
 	}
 
 
-	while (now = times(NULL),
+	while (now = times(&tms_unused),
 		(wraparound && (now > starttime || now <= endtime))
 		||	(!wraparound && now <= endtime)) {
 
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 85de949..ff5d499 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -366,7 +366,7 @@ ipmi_op(struct ipmi *ipmi, int op, struct Etoken *toklist)
 static int
 ipmi_off(struct ipmi *ipmi)
 {
-	int ret, retries = 5;
+	int ret, retries = 7;
 
 	ret = ipmi_op(ipmi, ST_STATUS, power_status);
 	switch(ret) {
@@ -378,12 +378,12 @@ ipmi_off(struct ipmi *ipmi)
 		return ret;
 	}
 
-	ret = ipmi_op(ipmi, ST_POWEROFF, power_off_complete);
-	if (ret != 0)
-		return ret;
-
 	while (retries>=0) {
-		sleep(5);
+		ret = ipmi_op(ipmi, ST_POWEROFF, power_off_complete);
+		if (ret != 0)
+			return ret;
+
+		sleep(2);
 		--retries;
 		ret = ipmi_op(ipmi, ST_STATUS, power_status);
 
@@ -408,7 +408,7 @@ ipmi_off(struct ipmi *ipmi)
 static int
 ipmi_on(struct ipmi *ipmi)
 {
-	int ret, retries = 5; 
+	int ret, retries = 7;
 
 	ret = ipmi_op(ipmi, ST_STATUS, power_status);
 	switch(ret) {
@@ -420,12 +420,12 @@ ipmi_on(struct ipmi *ipmi)
 		return ret;
 	}
 
-	ret = ipmi_op(ipmi, ST_POWERON, power_on_complete);
-	if (ret != 0)
-		return ret;
-
 	while (retries>=0) {
-		sleep(5);
+		ret = ipmi_op(ipmi, ST_POWERON, power_on_complete);
+		if (ret != 0)
+			return ret;
+
+		sleep(2);
 		--retries;
 		ret = ipmi_op(ipmi, ST_STATUS, power_status);
 
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 7b7f8d5..61de279 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -122,6 +122,12 @@ all_opt = {
 		"longopt" : "drac-version",
 		"help" : "-D, --drac-version=<version>   Force DRAC version to use",
 		"order" : 1 },
+	"hmc_version" : {
+		"getopt" : "H:",
+		"longopt" : "hmc-version",
+		"help" : "-H, --hmc-version=<version>   Force HMC version to use: 3, 4 (default)",
+		"default" : "4", 
+		"order" : 1 },
 	"ribcl" : {
 		"getopt" : "r:",
 		"longopt" : "ribcl-version",
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 44b3a71..d74397c 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -21,19 +21,30 @@ BUILD_DATE=""
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	try:
-		conn.send("lssyscfg -r lpar -m "+ options["-s"] +" --filter 'lpar_names=" + options["-n"] + "'\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
+	if options["-H"] == "3":
+		try:
+			conn.send("lssyscfg -r lpar -m " + options["-s"] + " -n " + options["-n"] + " -F name,state\n")
+			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		except pexpect.EOF:
+			fail(EC_CONNECTION_LOST)
+		except pexpect.TIMEOUT:
+			fail(EC_TIMED_OUT)
+
+		status = re.compile("^" + options["-n"] + ",(.*?),.*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
+	elif options["-H"] == "4":
+		try:
+			conn.send("lssyscfg -r lpar -m "+ options["-s"] +" --filter 'lpar_names=" + options["-n"] + "'\n")
+			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		except pexpect.EOF:
+			fail(EC_CONNECTION_LOST)
+		except pexpect.TIMEOUT:
+			fail(EC_TIMED_OUT)
 				
-	status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
+		status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
 
 	##
 	## Transformation to standard ON/OFF status if possible
-	if status in ["Running", "Open Firmware", "Shutting Down"]:
+	if status in ["Running", "Open Firmware", "Shutting Down", "Starting"]:
 		status = "on"
 	else:
 		status = "off"
@@ -41,21 +52,31 @@ def get_power_status(conn, options):
 	return status
 
 def set_power_status(conn, options):
-	try:
-		if options["-o"] == "on":
-			conn.send("chsysstate -o on -r lpar -m " + options["-s"] + 
-				" -n " + options["-n"] + 
-				" -f `lssyscfg -r lpar -F curr_profile " +
-				" -m " + options["-s"] +
-				" --filter \"lpar_names="+ options["-n"] +"\"`\n" )
-		else:
-			conn.send("chsysstate -o shutdown -r lpar --immed" +
-				" -m " + options["-s"] + " -n " + options["-n"] + "\n")		
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
+	if options["-H"] == "3":
+		try:
+			conn.send("chsysstate -o " + options["-o"] + " -r lpar -m " + options["-s"]
+				+ " -n " + options["-n"] + "\n")
+			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		except pexpect.EOF:
+			fail(EC_CONNECTION_LOST)
+		except pexpect.TIMEOUT:
+			fail(EC_TIMED_OUT)		
+	elif options["-H"] == "4":
+		try:
+			if options["-o"] == "on":
+				conn.send("chsysstate -o on -r lpar -m " + options["-s"] + 
+					" -n " + options["-n"] + 
+					" -f `lssyscfg -r lpar -F curr_profile " +
+					" -m " + options["-s"] +
+					" --filter \"lpar_names="+ options["-n"] +"\"`\n" )
+			else:
+				conn.send("chsysstate -o shutdown -r lpar --immed" +
+					" -m " + options["-s"] + " -n " + options["-n"] + "\n")		
+			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		except pexpect.EOF:
+			fail(EC_CONNECTION_LOST)
+		except pexpect.TIMEOUT:
+			fail(EC_TIMED_OUT)
 
 def get_lpar_list(conn, options):
 	outlets = { }
@@ -85,7 +106,7 @@ def get_lpar_list(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure", "partition", "managed" ]
+			"secure", "partition", "managed", "hmc_version", "cmd_prompt" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
@@ -93,7 +114,7 @@ def main():
 	## Fence agent specific defaults
 	#####
 	if 0 == options.has_key("-c"):
-		options["-c"] = ":~>"
+		options["-c"] = [ ":~>", "]\$" ]
 
 	if 0 == options.has_key("-x"):
 		fail_usage("Failed: You have to use ssh connection (-x) to fence device")
@@ -104,6 +125,9 @@ def main():
         if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")):
                 fail_usage("Failed: You have to enter name of the partition")
 
+	if 1 == options.has_key("-H") and (options["-H"] != "3" and options["-H"] != "4"):
+		fail_usage("Failed: You have to enter valid version number: 3 or 4")
+
 	##
 	## Operate the fencing device
 	####
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 29aace7..9f5ec8f 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -75,7 +75,8 @@ def set_power_status(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure", "port", "no_login", "test" ]
+			"cmd_prompt", "secure", "port", "no_login", "no_password",
+			"test" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
@@ -88,15 +89,22 @@ def main():
 	##
 	## Operate the fencing device
 	##
-	## @note: if there is not a login name then we assume that it is WTI-IPS
-	##        where no login name is used
+	## @note: if it possible that this device does not need either login, password or both of them
 	#####	
-	if (0 == options.has_key("-l")):
+	if 0 == options.has_key("-x"):
 		try:
 			conn = fspawn ('telnet ' + options["-a"])
-			conn.log_expect(options, "Password: ", SHELL_TIMEOUT)
-			conn.send(options["-p"]+"\r\n")
-			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+			re_login = re.compile("(login: )|(Login Name:  )|(username: )|(User Name :)", re.IGNORECASE)
+			re_prompt = re.compile("|".join(map (lambda x: "(" + x + ")", options["-c"])), re.IGNORECASE)
+
+			result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT)
+			if result == 0:
+				conn.send(options["-l"]+"\r\n")
+				result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT)
+		
+			if result == 1:
+				conn.send(options["-p"]+"\r\n")
+				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)	
 		except pexpect.EOF:
 			fail(EC_LOGIN_DENIED) 
 		except pexpect.TIMEOUT:


Index: cluster.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cluster/devel/cluster.spec,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- cluster.spec	6 Feb 2009 08:01:02 -0000	1.37
+++ cluster.spec	19 Feb 2009 09:01:10 -0000	1.38
@@ -19,11 +19,12 @@
 Name: cluster
 Summary: Red Hat Cluster
 Version: 3.0.0
-Release: 6%{?alphatag:.%{alphatag}}%{?dist}
+Release: 7%{?alphatag:.%{alphatag}}%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: System Environment/Base
 URL: http://sources.redhat.com/cluster/wiki/
 Source0: ftp://sources.redhat.com/pub/cluster/releases/cluster-%{version}%{?alphatag:.%{alphatag}}.tar.gz
+Patch0: cluster-stable3-head.diff
 
 ## Setup/build bits
 
@@ -39,8 +40,8 @@
 BuildRequires: perl python
 BuildRequires: glibc-kernheaders glibc-devel
 BuildRequires: libxml2-devel ncurses-devel slang-devel libvolume_id-devel
-BuildRequires: corosynclib-devel >= 0.92-7
-BuildRequires: openaislib-devel >= 0.91-6
+BuildRequires: corosynclib-devel >= 0.93-1
+BuildRequires: openaislib-devel >= 0.92-1
 BuildRequires: openldap-devel perl(ExtUtils::MakeMaker)
 %if %{buildvirt}
 BuildRequires: nss-devel nspr-devel libvirt-devel xen-libs
@@ -48,6 +49,7 @@
 
 %prep
 %setup -q -n cluster-%{version}%{?alphatag:.%{alphatag}}
+%patch0 -p1
 
 %build
 # for legacy reasons, all binaries have always been installed in /sbin
@@ -111,8 +113,8 @@
 Requires(post): chkconfig
 Requires(preun): initscripts
 Requires(preun): chkconfig
-Requires: corosync >= 0.92-7
-Requires: openais >= 0.91-6
+Requires: corosync >= 0.93-1
+Requires: openais >= 0.92-1
 Requires: sg3_utils OpenIPMI telnet openssh-clients
 Requires: pexpect net-snmp-utils pyOpenSSL
 Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
@@ -180,7 +182,7 @@
 Group: System Environment/Libraries
 Summary: The Red Hat Cluster libraries
 Conflicts: cman < 3.0.0-5.alpha4
-Provides: cmanlib = 3.0.0-5.alpha4
+Provides: cmanlib = %{version}
 Obsoletes: cmanlib < 3.0.0-5.alpha4
 
 %description -n clusterlib
@@ -204,9 +206,9 @@
 Summary: The Red Hat Cluster libraries development package
 Requires: clusterlib = %{version}-%{release}
 Requires: pkgconfig
-Provides: cman-devel = 3.0.0-5.alpha4
+Provides: cman-devel = %{version}
 Obsoletes: cman-devel < 3.0.0-5.alpha4
-Provides: cmanlib-devel = 3.0.0-5.alpha4
+Provides: cmanlib-devel = %{version}
 Obsoletes: cmanlib-devel < 3.0.0-5.alpha4
 
 %description -n clusterlib-devel
@@ -324,6 +326,11 @@
 %{_mandir}/man8/*.gfs.*
 
 %changelog
+* Thu Feb 19 2009 Fabio M. Di Nitto <fdinitto at redhat.com> - 3.0.0-7.alpha4
+- Update to latest stable3 code from git (e3a9ac674fa0ff025e833dcfbc8575cada369843)
+- Fix Provides: version.
+- Update corosync/openais BuildRequires and Requires
+
 * Fri Feb  6 2009 Fabio M. Di Nitto <fdinitto at redhat.com> - 3.0.0-6.alpha4
 - Fix datadir/fence directory ownership.
 




More information about the scm-commits mailing list