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

[Cluster-devel] cluster/rgmanager ChangeLog src/daemons/groups ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh sourceware org	2007-09-28 15:14:52

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/src/daemons: groups.c resrules.c restree.c 

Log message:
	Fix #310981 - status check timers wrong

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.31&r2=1.5.2.32
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.20&r2=1.8.2.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.7&r2=1.9.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.16&r2=1.10.2.17

--- cluster/rgmanager/ChangeLog	2007/09/25 14:00:41	1.5.2.31
+++ cluster/rgmanager/ChangeLog	2007/09/28 15:14:52	1.5.2.32
@@ -1,3 +1,7 @@
+2007-10-28 Lon hohberger <lhh at redhat.com>
+	* include/reslist.h, src/daemons/resgroup.c, restree.c:
+	Fix #310981
+
 2007-10-25 Lon Hohberger <lhh at redhat.com>
 	* src/resources/clusterfs.sh: Make self_fence work. #252241
 	* src/resources/SAPInstance, SAPDatabase, Makefile: Add 
--- cluster/rgmanager/src/daemons/groups.c	2007/07/31 18:26:39	1.8.2.20
+++ cluster/rgmanager/src/daemons/groups.c	2007/09/28 15:14:52	1.8.2.21
@@ -133,6 +133,40 @@
 }
 
 
+static inline int 
+is_exclusive_res(resource_t *res)
+{
+	char *val;
+
+	val = res_attr_value(res, "exclusive");
+	if (val && ((!strcmp(val, "yes") ||
+			(atoi(val)>0))) ) {
+		return 1;
+	}
+	return 0;
+}
+
+
+/* Locked exported function */
+int 
+is_exclusive(char *svcName)
+{
+	int ret = 0;
+	resource_t *res = NULL;
+
+	pthread_rwlock_rdlock(&resource_lock);
+	res = find_root_by_ref(&_resources, svcName);
+
+	if (!res)
+		ret = RG_ENOSERVICE;
+	else
+		ret = is_exclusive_res(res);
+
+	pthread_rwlock_unlock(&resource_lock);
+	return ret;
+}
+
+
 int get_rg_state_local(char *, rg_state_t *);
 int
 count_resource_groups_local(cluster_member_t *mp)
@@ -147,6 +181,7 @@
 	pthread_rwlock_rdlock(&resource_lock);
 
 	list_do(&_resources, res) {
+
 		if (res->r_rule->rr_root == 0)
 			continue;
 
@@ -165,11 +200,8 @@
 
 		++mp->cm_svccount;
 
-		val = res_attr_value(res, "exclusive");
-		if (val && ((!strcmp(val, "yes") ||
-				     (atoi(val)>0))) ) {
+		if (is_exclusive_res(res)) 
 			++mp->cm_svcexcl;
-		}
 
 	} while (!list_done(&_resources, res));
 
@@ -180,21 +212,17 @@
 
 
 int
-have_exclusive_resources()
+have_exclusive_resources(void)
 {
 	resource_t *res;
-	char *val;
 
 	pthread_rwlock_rdlock(&resource_lock);
 
 	list_do(&_resources, res) {
-		val = res_attr_value(res, "exclusive");
-		if (val && ((!strcmp(val, "yes") ||
-				     (atoi(val)>0))) ) {
+		if (is_exclusive_res(res)) {
 			pthread_rwlock_unlock(&resource_lock);
 			return 1;
 		}
-
 	} while (!list_done(&_resources, res));
 
 	pthread_rwlock_unlock(&resource_lock);
--- cluster/rgmanager/src/daemons/resrules.c	2007/03/20 19:40:06	1.9.2.7
+++ cluster/rgmanager/src/daemons/resrules.c	2007/09/28 15:14:52	1.9.2.8
@@ -298,6 +298,7 @@
 		acts[0].ra_depth = depth;
 		acts[0].ra_timeout = timeout;
 		acts[0].ra_interval = interval;
+		acts[0].ra_last = 0;
 		acts[1].ra_name = NULL;
 
 		*actsp = acts;
@@ -342,6 +343,7 @@
 	acts[x].ra_depth = depth;
 	acts[x].ra_timeout = timeout;
 	acts[x].ra_interval = interval;
+	acts[x].ra_last = 0;
 
 	acts[x+1].ra_name = NULL;
 
--- cluster/rgmanager/src/daemons/restree.c	2007/05/02 22:54:28	1.10.2.16
+++ cluster/rgmanager/src/daemons/restree.c	2007/09/28 15:14:52	1.10.2.17
@@ -1053,35 +1053,51 @@
 
 	now = time(NULL);
 
-       for (; node->rn_actions[x].ra_name; x++) {
+	for (; node->rn_actions[x].ra_name; x++) {
 		if (!has_recover &&
-                   !strcmp(node->rn_actions[x].ra_name, "recover")) {
+		    !strcmp(node->rn_actions[x].ra_name, "recover")) {
 			has_recover = 1;
 			continue;
 		}
 
-               if (strcmp(node->rn_actions[x].ra_name, "status"))
+		if (strcmp(node->rn_actions[x].ra_name, "status"))
 			continue;
 
-               delta = now - node->rn_actions[x].ra_last;
+		delta = now - node->rn_actions[x].ra_last;
+
+		/*
+		printf("%s:%s %s level %d interval = %d  elapsed = %d\n",
+			node->rn_resource->r_rule->rr_type,
+			node->rn_resource->r_attrs->ra_value,
+			node->rn_actions[x].ra_name, node->rn_actions[x].ra_depth,
+			(int)node->rn_actions[x].ra_interval, (int)delta);
+		 */
 
-		/* Ok, it's a 'monitor' action. See if enough time has
-		   elapsed for a given type of monitoring action */
-               if (delta < node->rn_actions[x].ra_interval)
+		/* Ok, it's a 'status' action. See if enough time has
+		   elapsed for a given type of status action */
+		if (delta < node->rn_actions[x].ra_interval)
 			continue;
 
 		if (idx == -1 ||
-                   node->rn_actions[x].ra_depth > node->rn_actions[idx].ra_depth)
+		    node->rn_actions[x].ra_depth > node->rn_actions[idx].ra_depth)
 			idx = x;
 	}
 
 	/* No check levels ready at the moment. */
-	if (idx == -1)
+	if (idx == -1) {
+		if (node->rn_checked)
+			return node->rn_last_status;
 		return 0;
+	}
+
+	node->rn_actions[idx].ra_last = now;
+	x = res_exec(node, RS_STATUS, node->rn_actions[idx].ra_depth);
 
-       node->rn_actions[idx].ra_last = now;
-	if ((x = res_exec(node, RS_STATUS,
-                         node->rn_actions[idx].ra_depth)) == 0)
+	node->rn_last_status = x;
+	node->rn_last_depth = node->rn_actions[idx].ra_depth;
+	node->rn_checked = 1;
+
+	if (x == 0)
 		return 0;
 
 	if (!has_recover)
@@ -1138,18 +1154,21 @@
 {
 	time_t now;
 	int x = 0;
-	resource_t *res = node->rn_resource;
 
-	now = res->r_started;
+	now = time(NULL);
 
-       for (; node->rn_actions[x].ra_name; x++) {
+	for (; node->rn_actions[x].ra_name; x++) {
 
-               if (strcmp(node->rn_actions[x].ra_name, "monitor") &&
-                   strcmp(node->rn_actions[x].ra_name, "status"))
+		if (strcmp(node->rn_actions[x].ra_name, "monitor") &&
+		    strcmp(node->rn_actions[x].ra_name, "status"))
 			continue;
 
-               node->rn_actions[x].ra_last = now;
+		node->rn_actions[x].ra_last = now;
 	}
+
+	node->rn_checked = 0;
+	node->rn_last_status = 0;
+	node->rn_last_depth = 0;
 }
 
 


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