[Cluster-devel] cluster/rgmanager/src clulib/msg_socket.c clul ...

lhh at sourceware.org lhh at sourceware.org
Fri Nov 30 21:01:28 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2007-11-30 21:01:27

Modified files:
	rgmanager/src/clulib: msg_socket.c vft.c 
	rgmanager/src/daemons: depends.c reslist.c restree.c 

Log message:
	Merge from RHEL5 branch, pass 3

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/msg_socket.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/vft.c.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/depends.c.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.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.38&r2=1.39

--- cluster/rgmanager/src/clulib/msg_socket.c	2007/10/26 19:02:43	1.2
+++ cluster/rgmanager/src/clulib/msg_socket.c	2007/11/30 21:01:27	1.3
@@ -44,7 +44,7 @@
 
 	memset(&sun, 0, sizeof(sun));
 	sun.sun_family = PF_LOCAL;
-	snprintf(sun.sun_path, sizeof(sun.sun_path), RGMGR_SOCK);
+	snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", RGMGR_SOCK);
 
 	sock = socket(PF_LOCAL, SOCK_STREAM, 0);
 	if (sock < 0) {
--- cluster/rgmanager/src/clulib/vft.c	2007/07/23 20:49:13	1.21
+++ cluster/rgmanager/src/clulib/vft.c	2007/11/30 21:01:27	1.22
@@ -734,7 +734,7 @@
 	if (!fp)
 		return -1;
 
-#if defined(__sparc__) || defined(__sparc64__)
+#if defined(__sparc__) || defined(__hppa__) || defined(__sparc64__) || defined (__hppa64__)
 	rv = fscanf(fp,"%ld.%d %ld.%d\n", &tv->tv_sec, &tv->tv_usec,
 		    &junk.tv_sec, &junk.tv_usec);
 #else
@@ -1368,6 +1368,7 @@
 {
 	vf_msg_t *hdrp;
 	int ret;
+	key_node_t *kn;
 
 	if ((nbytes <= 0) || (nbytes < sizeof(generic_msg_hdr)) ||
 	    (msgp->gh_command != VF_MESSAGE))
@@ -1422,8 +1423,13 @@
 #endif
 		pthread_mutex_lock(&key_list_mutex);
 		vf_buffer_commit(msgp->gh_arg2);
-		ret = (vf_resolve_views(kn_find_trans(msgp->gh_arg2)) ?
-			VFR_COMMIT : VFR_OK);
+		kn = kn_find_trans(msgp->gh_arg2);
+		if (!kn) {
+			pthread_mutex_unlock(&key_list_mutex);
+			return VFR_OK;
+		}
+
+		ret = (vf_resolve_views(kn) ? VFR_COMMIT : VFR_OK);
 		pthread_mutex_unlock(&key_list_mutex);
 		return ret;
 
--- cluster/rgmanager/src/daemons/depends.c	2007/03/20 17:09:57	1.3
+++ cluster/rgmanager/src/daemons/depends.c	2007/11/30 21:01:27	1.4
@@ -36,6 +36,8 @@
  */
 #include <string.h>
 #include <list.h>
+#include <time.h>
+#include <restart_counter.h>
 #include <clulog.h>
 #include <resgroup.h>
 #include <reslist.h>
--- cluster/rgmanager/src/daemons/reslist.c	2007/11/30 20:36:17	1.20
+++ cluster/rgmanager/src/daemons/reslist.c	2007/11/30 21:01:27	1.21
@@ -824,7 +824,6 @@
 	}
 
 	if (!found) {
-		//printf("No attributes found for %s\n", base);
 		destroy_resource(res);
 		return NULL;
 	}
--- cluster/rgmanager/src/daemons/restree.c	2007/11/30 20:36:17	1.38
+++ cluster/rgmanager/src/daemons/restree.c	2007/11/30 21:01:27	1.39
@@ -561,7 +561,6 @@
 		free(ref);
 	}
 
-
 	curres->r_refs++;
 
 	*newnode = node;
@@ -822,7 +821,6 @@
 {
 	resource_node_t *node;
 	int x, y;
-	char *val;
 
 	list_do(tree, node) {
 		for (x = 0; x < level; x++)
@@ -847,14 +845,11 @@
 		     node->rn_resource->r_attrs[x].ra_value; x++) {
 			for (y = 0; y < level+1; y++)
 				printf("  ");
-
-			val = attr_value(node,
-					 node->rn_resource->r_attrs[x].ra_name);
-			if (!val &&
-			    node->rn_resource->r_attrs[x].ra_flags&RA_INHERIT)
-				continue;
 			printf("%s = \"%s\";\n",
-			       node->rn_resource->r_attrs[x].ra_name, val);
+			       node->rn_resource->r_attrs[x].ra_name,
+			       attr_value(node,
+					  node->rn_resource->r_attrs[x].ra_name)
+			      );
 		}
 
 		_print_resource_tree(&node->rn_child, level + 1);
@@ -1080,38 +1075,20 @@
 	if (idx == -1) {
 		if (node->rn_checked)
 			return node->rn_last_status;
-  		return 0;
+		return 0;
 	}
 
- 	/* 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);*/
- 
- 	node->rn_actions[idx].ra_last = now;
- 	x = res_exec(node, RS_STATUS, NULL, node->rn_actions[idx].ra_depth);
- 
- 	node->rn_last_status = x;
- 	node->rn_last_depth = node->rn_actions[idx].ra_depth;
- 	node->rn_checked = 1;
- 	if (x == 0)
-  		return 0;
+
+	node->rn_actions[idx].ra_last = now;
+	x = res_exec(node, RS_STATUS, NULL, node->rn_actions[idx].ra_depth);
+
+	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)
 		return x;
 
@@ -1200,7 +1177,6 @@
    @param realop	Operation to perform if either first is found,
    			or no first is declared (in which case, all nodes
 			in the subtree).
-   @param node		Node we're operating on
    @see			_res_op_by_level res_exec
  */
 static inline int
@@ -1306,9 +1282,23 @@
 
 	}
 
-	if (node->rn_child)
-		rv |= _res_op_by_level(&node, me?NULL:first, ret, op);
+       if (node->rn_child) {
+                rv |= _res_op_by_level(&node, me?NULL:first, ret, op);
 
+               /* If one or more child resources are failed and at least one
+		  of them is not an independent subtree then let's check if
+		  if we are an independent subtree.  If so, mark ourself
+		  and all our children as failed and return a flag stating
+		  that this section is recoverable apart from siblings in
+		  the resource tree. */
+		if (op == RS_STATUS && (rv & SFL_FAILURE) &&
+		    (node->rn_flags & RF_INDEPENDENT)) {
+			mark_nodes(node, RES_FAILED,
+				   RF_NEEDSTART | RF_NEEDSTOP);
+			rv = SFL_RECOVERABLE;
+		}
+	}
+ 			
 	/* Stop should occur after children have stopped */
 	if (me && (op == RS_STOP)) {
 		node->rn_flags &= ~RF_NEEDSTOP;




More information about the Cluster-devel mailing list