cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager ChangeLog src/daemons/groups ...
Date: 28 Sep 2007 15:14:53 -0000	[thread overview]
Message-ID: <20070928151453.6831.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh at 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@redhat.com>
+	* include/reslist.h, src/daemons/resgroup.c, restree.c:
+	Fix #310981
+
 2007-10-25 Lon Hohberger <lhh@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;
 }
 
 



             reply	other threads:[~2007-09-28 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 15:14 lhh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-12-12 21:41 [Cluster-devel] cluster/rgmanager ChangeLog src/daemons/groups lhh
2007-07-31 18:26 lhh
2007-07-10 18:25 lhh
2007-07-10 18:24 lhh
2007-07-02 15:15 lhh
2007-07-02 15:13 lhh
2007-04-19 18:05 lhh
2007-04-19 17:59 lhh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070928151453.6831.qmail@sourceware.org \
    --to=lhh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).