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/src daemons/resrules.c daemo ...
Date: 4 Apr 2007 19:22:30 -0000	[thread overview]
Message-ID: <20070404192230.628.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2007-04-04 20:22:29

Modified files:
	rgmanager/src/daemons: resrules.c restree.c 
	rgmanager/src/resources: clusterfs.sh 

Log message:
	allow ocfs[2] to work with the clusterfs resource agent.  Also, commit patch which corrects interval processing for status operations

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/clusterfs.sh.diff?cvsroot=cluster&r1=1.15&r2=1.16

--- cluster/rgmanager/src/daemons/resrules.c	2007/03/27 19:33:20	1.20
+++ cluster/rgmanager/src/daemons/resrules.c	2007/04/04 19:22:29	1.21
@@ -274,6 +274,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;
@@ -297,6 +298,7 @@
 				       (int)interval);
 				acts[x].ra_interval = interval;
 			}
+			acts[x].ra_last = 0;
 			printf("\n");
 			replace = 1;
 		}
@@ -318,6 +320,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/03/23 00:00:07	1.28
+++ cluster/rgmanager/src/daemons/restree.c	2007/04/04 19:22:29	1.29
@@ -1019,25 +1019,39 @@
 
 	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;
+		/* If a status check has never been done, reset its status. */
+		if (!node->rn_actions[x].ra_last) {
+			node->rn_actions[x].ra_last = now;
+			continue;
+		}
+
+		delta = now - node->rn_actions[x].ra_last;
 
-		/* 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)
+		/*
+		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 '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;
 	}
 
@@ -1045,7 +1059,27 @@
 	if (idx == -1)
 		return 0;
 
-       node->rn_actions[idx].ra_last = now;
+ 	/* Clear all check levels lower than us */
+ 	for (x = 0; node->rn_actions[x].ra_name; x++) {
+ 		if (x == idx) {
+ 			node->rn_actions[idx].ra_last = now;
+ 			continue;
+ 		}
+ 		if (strcmp(node->rn_actions[x].ra_name, "status"))
+ 			continue;
+ 
+ 		if (node->rn_actions[x].ra_depth <
+ 		    node->rn_actions[idx].ra_depth)
+ 			node->rn_actions[x].ra_last = now;
+ 	}
+ 
+ 	/*printf("-> %s:%s %s level %d interval = %d\n",
+ 		node->rn_resource->r_rule->rr_type,
+ 		node->rn_resource->r_attrs->ra_value,
+ 		node->rn_actions[idx].ra_name,
+ 		node->rn_actions[idx].ra_depth,
+ 		(int)node->rn_actions[idx].ra_interval);*/
+ 
 	if ((x = res_exec(node, agent_op_str(RS_STATUS), NULL,
                          node->rn_actions[idx].ra_depth)) == 0)
 		return 0;
--- cluster/rgmanager/src/resources/clusterfs.sh	2006/10/25 15:38:55	1.15
+++ cluster/rgmanager/src/resources/clusterfs.sh	2007/04/04 19:22:29	1.16
@@ -279,6 +279,9 @@
 	gfs)
 		return $OCF_SUCCESS
 		;;
+	ocfs|ocfs2)
+		return $OCF_SUCCESS
+		;;
 	*)
 		ocf_log err "File system type $OCF_RESKEY_fstype not supported"
 		return $OCF_ERR_ARGS



             reply	other threads:[~2007-04-04 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 19:22 lhh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-01-26 20:41 [Cluster-devel] cluster/rgmanager/src daemons/resrules.c daemo 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=20070404192230.628.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).