[Cluster-devel] cluster/rgmanager/src daemons/resrules.c daemo ...

lhh at sourceware.org lhh at sourceware.org
Wed Apr 4 19:22:30 UTC 2007


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




More information about the Cluster-devel mailing list