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

[Cluster-devel] cluster/rgmanager include/reslist.h src/daemon ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh sourceware org	2007-03-22 23:46:59

Modified files:
	rgmanager/include: reslist.h 
	rgmanager/src/daemons: reslist.c resrules.c restree.c test.c 
	rgmanager/src/daemons/tests: delta-test007-test008.expected 
	                             delta-test008-test009.expected 
	                             delta-test009-test010.expected 
	                             delta-test010-test011.expected 
	                             delta-test011-test012.expected 
	                             delta-test012-test013.expected 
	                             delta-test013-test014.expected 
	                             delta-test014-test015.expected 
	                             delta-test015-test016.expected 
	                             gentests.sh runtests.sh 
	                             test008.expected test009.expected 
	                             test010.expected test011.expected 
	                             test012.expected test013.expected 
	                             test014.expected test015.expected 
	                             test016.expected 
Added files:
	rgmanager/src/daemons/tests: delta-test016-test017.expected 
	                             test001.start.expected 
	                             test001.stop.expected 
	                             test002.start.expected 
	                             test002.stop.expected 
	                             test003.start.expected 
	                             test003.stop.expected 
	                             test004.start.expected 
	                             test004.stop.expected 
	                             test005.start.expected 
	                             test005.stop.expected 
	                             test006.start.expected 
	                             test006.stop.expected 
	                             test007.start.expected 
	                             test007.stop.expected 
	                             test008.start.expected 
	                             test008.stop.expected 
	                             test009.start.expected 
	                             test009.stop.expected 
	                             test010.start.expected 
	                             test010.stop.expected 
	                             test011.start.expected 
	                             test011.stop.expected 
	                             test012.start.expected 
	                             test012.stop.expected 
	                             test013.start.expected 
	                             test013.stop.expected 
	                             test014.start.expected 
	                             test014.stop.expected 
	                             test015.start.expected 
	                             test015.stop.expected 
	                             test016.start.expected 
	                             test016.stop.expected test017.conf 
	                             test017.expected 
	                             test017.start.expected 
	                             test017.stop.expected 

Log message:
	Merge ordering patch from RHEL4 branch; update automated test cases

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/reslist.h.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/test.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test016-test017.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test001.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test001.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test002.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test002.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test003.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test003.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test004.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test004.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test005.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test005.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test006.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test006.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test007.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test007.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test008.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test008.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test009.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test009.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test010.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test010.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test011.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test011.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test012.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test012.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test013.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test013.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test014.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test014.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test015.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test015.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test016.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test016.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test017.conf.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test017.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test017.start.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test017.stop.expected.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test007-test008.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test008-test009.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test009-test010.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test010-test011.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test011-test012.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test012-test013.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test013-test014.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test014-test015.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/delta-test015-test016.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/gentests.sh.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/runtests.sh.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test008.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test009.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test010.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test011.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test012.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test013.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test014.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test015.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/tests/test016.expected.diff?cvsroot=cluster&r1=1.3&r2=1.4

--- cluster/rgmanager/include/reslist.h	2007/03/20 17:09:56	1.18
+++ cluster/rgmanager/include/reslist.h	2007/03/22 23:46:58	1.19
@@ -68,7 +68,7 @@
 	int	rc_startlevel;
 	int	rc_stoplevel;
 	int	rc_forbid;
-	int	_pad_;
+	int	rc_flags;
 } resource_child_t;
 
 
--- cluster/rgmanager/src/daemons/reslist.c	2007/01/26 21:57:01	1.16
+++ cluster/rgmanager/src/daemons/reslist.c	2007/03/22 23:46:58	1.17
@@ -413,17 +413,52 @@
 {
 	char *val = NULL, *ret = NULL;
 	xmlXPathObjectPtr obj;
+	xmlNodePtr node;
+	size_t size = 0;
+	int nnv = 0;
 
 	obj = xmlXPathEvalExpression((unsigned char *)query, ctx);
 	if (!obj)
 		return NULL;
+	if (!obj->nodesetval)
+		goto out;
+	if (obj->nodesetval->nodeNr <= 0)
+		goto out;
+
+	node = obj->nodesetval->nodeTab[0];
+	if(!node)
+		goto out;
+
+	if (((node->type == XML_ATTRIBUTE_NODE) && strstr(query, "@*")) ||
+	    ((node->type == XML_ELEMENT_NODE) && strstr(query, "child::*"))){
+		if (node->children && node->children->content)
+	  		size = strlen((char *)node->children->content)+
+				      strlen((char *)node->name)+2;
+		else 
+			size = strlen((char *)node->name)+2;
+		nnv = 1;
+	} else {
+		if (node->children && node->children->content) {
+			size = strlen((char *)node->children->content)+1;
+		} else {
+			goto out;
+		}
+	}
 
-	if (obj->nodesetval && obj->nodesetval->nodeNr >= 1) {
-		val = (char *)obj->nodesetval->nodeTab[0]->children->content;
-		if (strlen(val) >= 1)
-			ret = strdup(val);
+	val = (char *)malloc(size);
+	if(!val)
+		goto out;
+	memset(val, 0, size);
+	if (nnv) {
+		sprintf(val, "%s=%s", node->name, node->children ?
+			(char *)node->children->content:"");
+	} else {
+		sprintf(val, "%s", node->children ? node->children->content :
+			node->name);
 	}
 
+	ret = val;
+out:
 	xmlXPathFreeObject(obj);
 
 	return ret;
--- cluster/rgmanager/src/daemons/resrules.c	2007/01/26 21:57:01	1.18
+++ cluster/rgmanager/src/daemons/resrules.c	2007/03/22 23:46:58	1.19
@@ -461,11 +461,12 @@
    @param start		Start level
    @param stop		Stop level
    @param forbid	Do NOT allow this child type to exist
+   @param flags		set to 1 to note that it was defined inline
    @return		0 on success, nonzero on failure
  */
 int
 store_childtype(resource_child_t **childp, char *name, int start, int stop,
-		int forbid)
+		int forbid, int flags)
 {
 	int x = 0;
 	resource_child_t *child = *childp;
@@ -481,6 +482,7 @@
 		child[0].rc_startlevel = start;
 		child[0].rc_stoplevel = stop;
 		child[0].rc_forbid = forbid;
+		child[0].rc_flags = flags;
 		child[1].rc_name = NULL;
 
 		*childp = child;
@@ -497,6 +499,7 @@
 	child[x].rc_startlevel = start;
 	child[x].rc_stoplevel = stop;
 	child[x].rc_forbid = forbid;
+	child[x].rc_flags = flags;
 	child[x+1].rc_name = NULL;
 
 	*childp = child;
@@ -789,7 +792,7 @@
 		 */
 		if (childname)
 			store_childtype(&rr->rr_childtypes, childname,
-					startlevel, stoplevel, forbid);
+					startlevel, stoplevel, forbid, 0);
 	}
 
 	return 0;
--- cluster/rgmanager/src/daemons/restree.c	2007/03/10 00:20:54	1.26
+++ cluster/rgmanager/src/daemons/restree.c	2007/03/22 23:46:58	1.27
@@ -42,10 +42,17 @@
 
 /* XXX from resrules.c */
 int store_childtype(resource_child_t **childp, char *name, int start,
-		    int stop, int forbid);
+		    int stop, int forbid, int flags);
 int _res_op(resource_node_t **tree, resource_t *first, char *type,
 	    void * __attribute__((unused))ret, int op);
+static inline int
+_res_op_internal(resource_node_t **tree, resource_t *first,
+		 char *type, void *__attribute__((unused))ret, int realop,
+		 resource_node_t *node);
 void print_env(char **env);
+static inline int _res_op_internal(resource_node_t **tree, resource_t *first,
+		 char *type, void *__attribute__((unused))ret, int realop,
+		 resource_node_t *node);
 
 /* XXX from reslist.c */
 void * act_dup(resource_act_t *acts);
@@ -74,6 +81,17 @@
 };
 
 
+/* XXX MEGA HACK */
+#ifdef NO_CCS
+static int _no_op_mode_ = 0;
+void
+_no_op_mode(int arg)
+{
+	_no_op_mode_ = arg;
+}
+#endif
+
+
 /**
    ocf_strerror
  */
@@ -331,6 +349,14 @@
 		return -errno;
 #endif
 
+#ifdef NO_CCS
+	if (_no_op_mode_) {
+		printf("[%s] %s:%s\n", op, res->r_rule->rr_type,
+		       res->r_attrs->ra_value);
+		return 0;
+	}
+#endif
+
 	childpid = fork();
 	if (childpid < 0)
 		return -errno;
@@ -400,6 +426,97 @@
 }
 
 
+static inline int
+do_load_resource(int ccsfd, char *base,
+	         resource_rule_t *rule,
+	         resource_node_t **tree,
+		 resource_t **reslist,
+		 resource_node_t *parent,
+		 resource_node_t **newnode)
+{
+	char tok[512];
+	char *ref;
+	resource_node_t *node;
+	resource_t *curres;
+
+	snprintf(tok, sizeof(tok), "%s/@ref", base);
+
+#ifndef NO_CCS
+	if (ccs_get(ccsfd, tok, &ref) != 0) {
+#else
+	if (conf_get(tok, &ref) != 0) {
+#endif
+		/* There wasn't an existing resource. See if there
+		   is one defined inline */
+		curres = load_resource(ccsfd, rule, base);
+		if (!curres) {
+			/* No ref and no new one inline == 
+			   no more of the selected type */
+			return 1;
+		}
+
+	       	if (store_resource(reslist, curres) != 0) {
+	 		printf("Error storing %s resource\n",
+	 		       curres->r_rule->rr_type);
+	 		destroy_resource(curres);
+			return -1;
+	 	}
+
+		curres->r_flags = RF_INLINE;
+
+	} else {
+
+		curres = find_resource_by_ref(reslist, rule->rr_type,
+						      ref);
+		if (!curres) {
+			printf("Error: Reference to nonexistent "
+			       "resource %s (type %s)\n", ref,
+			       rule->rr_type);
+			free(ref);
+			return -1;
+		}
+
+		if (curres->r_flags & RF_INLINE) {
+			printf("Error: Reference to inlined "
+			       "resource %s (type %s) is illegal\n",
+			       ref, rule->rr_type);
+			free(ref);
+			return -1;
+		}
+		free(ref);
+	}
+
+	/* Load it if its max refs hasn't been exceeded */
+	if (rule->rr_maxrefs && (curres->r_refs >= rule->rr_maxrefs)){
+		printf("Warning: Max references exceeded for resource"
+		       " %s (type %s)\n", curres->r_attrs[0].ra_name,
+		       rule->rr_type);
+		return -1;
+	}
+
+	node = malloc(sizeof(*node));
+	if (!node)
+		return -1;
+
+	memset(node, 0, sizeof(*node));
+
+	//printf("New resource tree node: %s:%s \n", curres->r_rule->rr_type,curres->r_attrs->ra_value);
+
+	node->rn_child = NULL;
+	node->rn_parent = parent;
+	node->rn_resource = curres;
+	node->rn_state = RES_STOPPED;
+	node->rn_actions = (resource_act_t *)act_dup(curres->r_actions);
+	curres->r_refs++;
+
+	*newnode = node;
+
+	list_insert(tree, node);
+
+	return 0;
+}
+
+
 /**
    Build the resource tree.  If a new resource is defined inline, add it to
    the resource list.  All rules, however, must have already been read in.
@@ -425,127 +542,173 @@
 	char tok[512];
 	resource_rule_t *childrule;
 	resource_node_t *node;
-	resource_t *curres;
 	char *ref;
 	char *newchild;
-	int x, y, flags;
+	char *tmp;
+	int ccount = 0, x = 0, y = 0, flags = 0;
 
-	for (x = 1; ; x++) {
-
-		/* Search for base/type[x]/@ref - reference an existing
-		   resource */
-		snprintf(tok, sizeof(tok), "%s/%s[%d]/@ref", base,
-			 rule->rr_type, x);
-
-#ifndef NO_CCS
-		if (ccs_get(ccsfd, tok, &ref) != 0) {
-#else
-		if (conf_get(tok, &ref) != 0) {
-#endif
-			/* There wasn't an existing resource. See if there
-			   is one defined inline */
-			snprintf(tok, sizeof(tok), "%s/%s[%d]", base, 
-				 rule->rr_type, x);
-
-			curres = load_resource(ccsfd, rule, tok);
-			if (!curres)
-				/* No ref and no new one inline == 
-				   no more of the selected type */
-				break;
+	//printf("DESCEND: %s / %s\n", rule?rule->rr_type:"(none)", base);
 
-		       	if (store_resource(reslist, curres) != 0) {
-		 		printf("Error storing %s resource\n",
-		 		       curres->r_rule->rr_type);
-		 		destroy_resource(curres);
+	/* Pass 1: typed / defined children */
+	for (y = 0; rule && rule->rr_childtypes &&
+     	     rule->rr_childtypes[y].rc_name; y++) {
+		
+	
+		flags = 0;
+		list_for(rulelist, childrule, x) {
+			if (strcmp(rule->rr_childtypes[y].rc_name,
+				   childrule->rr_type))
 				continue;
-		 	}
 
-			curres->r_flags = RF_INLINE;
+			flags |= RFL_FOUND;
 
+			if (rule->rr_childtypes[y].rc_forbid)
+				flags |= RFL_FORBID;
 
-		} else {
-
-			curres = find_resource_by_ref(reslist, rule->rr_type,
-						      ref);
-			if (!curres) {
-				printf("Error: Reference to nonexistent "
-				       "resource %s (type %s)\n", ref,
-				       rule->rr_type);
-				free(ref);
-				continue;
-			}
-
-			if (curres->r_flags & RF_INLINE) {
-				printf("Error: Reference to inlined "
-				       "resource %s (type %s) is illegal\n",
-				       ref, rule->rr_type);
-				free(ref);
-				continue;
-			}
-			free(ref);
+			break;
 		}
 
-		/* Load it if its max refs hasn't been exceeded */
-		if (rule->rr_maxrefs && (curres->r_refs >= rule->rr_maxrefs)){
-			printf("Warning: Max references exceeded for resource"
-			       " %s (type %s)\n", curres->r_attrs[0].ra_name,
-			       rule->rr_type);
+		if (flags & RFL_FORBID)
+			/* Allow all *but* forbidden */
 			continue;
-		}
 
-		node = malloc(sizeof(*node));
-		if (!node)
+		if (!(flags & RFL_FOUND))
+			/* Not found?  Wait for pass 2 */
 			continue;
 
-		memset(node, 0, sizeof(*node));
+		//printf("looking for %s %s @ %s\n",
+			//rule->rr_childtypes[y].rc_name,
+			//childrule->rr_type, base);
+		for (x = 1; ; x++) {
+
+			/* Search for base/type[x]/@ref - reference an existing
+			   	resource */
+			snprintf(tok, sizeof(tok), "%s/%s[%d]", base,
+				 childrule->rr_type, x);
+
+			flags = 1;
+			switch(do_load_resource(ccsfd, tok, childrule, tree,
+						reslist, parent, &node)) {
+			case -1:
+				continue;
+			case 1:
+				/* 1 == no more */
+				//printf("No resource found @ %s\n", tok);
+				flags = 0;
+				break;
+			case 0:
+				break;
+			}
+			if (!flags)
+				break;
+
+			/* Got a child :: bump count */
+			snprintf(tok, sizeof(tok), "%s/%s[%d]", base,
+				 childrule->rr_type, x);
 
-		node->rn_child = NULL;
-		node->rn_parent = parent;
-		node->rn_resource = curres;
-		node->rn_state = RES_STOPPED;
-		node->rn_actions = (resource_act_t *)act_dup(curres->r_actions);
-		curres->r_refs++;
+			/* Kaboom */
+			build_tree(ccsfd, &node->rn_child, node, childrule,
+				   rulelist, reslist, tok);
 
-		list_insert(tree, node);
+		}
+	}
 
-		list_do(rulelist, childrule) {
 
-			flags = 0;
-			for (y = 0; rule->rr_childtypes &&
-		     	     rule->rr_childtypes[y].rc_name; y++) {
+	/* Pass 2: untyped children */
+	for (ccount=1; ; ccount++) {
+		snprintf(tok, sizeof(tok), "%s/child::*[%d]", base, ccount);
 
-				if (strcmp(rule->rr_childtypes[y].rc_name,
-					   childrule->rr_type))
-					continue;
+#ifndef NO_CCS
+		if (ccs_get(ccsfd, tok, &ref) != 0) {
+#else
+		if (conf_get(tok, &ref) != 0) {
+#endif
+			/* End of the line. */
+			//printf("End of the line: %s\n", tok);
+			break;
+		}
 
-				flags |= RFL_FOUND;
+		tmp = strchr(ref, '=');
+		if (tmp) {
+			*tmp = 0;
+		} else {
+			/* no = sign... bad */
+			free(ref);
+			continue;
+		}
 
-				if (rule->rr_childtypes[y].rc_forbid)
-					flags |= RFL_FORBID;
+		/* Find the resource rule */
+		flags = 0;
+		list_for(rulelist, childrule, x) {
+			if (!strcasecmp(childrule->rr_type, ref)) {
+				/* Ok, matching rule found */
+				flags = 1;
+				break;
 			}
+		}
+		/* No resource rule matching the child?  Press on... */
+		if (!flags)
+			continue;
 
-			if (flags & RFL_FORBID)
-				/* Allow all *but* forbidden */
+		flags = 0;
+		/* Don't descend on anything we should have already picked
+		   up on in the above loop */
+		for (y = 0; rule && rule->rr_childtypes &&
+		     rule->rr_childtypes[y].rc_name; y++) {
+			/* SKIP defined child types of any type */
+			if (strcmp(rule->rr_childtypes[y].rc_name, ref))
 				continue;
-
-			/* XXX Store new child type with start/stop level 0*/
-			/*     This is really ugly to do it here */
-			if (!(flags & RFL_FOUND)) {
-				newchild = strdup(childrule->rr_type);
-				store_childtype(&rule->rr_childtypes,
-						newchild, 0, 0, 0);
+			if (rule->rr_childtypes[y].rc_flags == 0) {
+				/* 2 = defined as a real child */
+				flags = 2;
+				break;
 			}
 
-			snprintf(tok, sizeof(tok), "%s/%s[%d]", base,
-				 rule->rr_type, x);
+			flags = 1;
+			break;
+		}
 
-			/* Kaboom */
-			build_tree(ccsfd, &node->rn_child, node, childrule,
-				   rulelist, reslist, tok);
+		if (flags == 2) {
+			free(ref);
+			continue;
+		}
 
-		} while (!list_done(rulelist, childrule));
+		/* store it once */
+		if (!flags && rule) {
+			//printf("Storing new child %s of %s\n",
+			       //ref, rule->rr_type);
+			newchild = strdup(ref);
+			store_childtype(&rule->rr_childtypes,
+					newchild, 0, 0, 0, 1);
+		}
+		free(ref);
+
+		x = 1;
+		switch(do_load_resource(ccsfd, tok, childrule, tree,
+				        reslist, parent, &node)) {
+		case -1:
+			continue;
+		case 1:
+			/* no more found */
+			x = 0;
+			printf("No resource found @ %s\n", tok);
+			break;
+		case 0:
+			/* another is found */
+			break;
+		}
+		if (!x) /* no more found */
+			break;
+
+		/* childrule = rule set of this child at this point */
+		/* tok = set above; if we got this far, we're all set */
+		/* Kaboom */
+
+		build_tree(ccsfd, &node->rn_child, node, childrule,
+			   rulelist, reslist, tok);
 	}
 
+	//printf("ASCEND: %s / %s\n", rule?rule->rr_type:"(none)", base);
 	return 0;
 }
 
@@ -574,7 +737,7 @@
 	/* Find and build the list of root nodes */
 	list_do(rulelist, curr) {
 
-		build_tree(ccsfd, &root, NULL, curr, rulelist, reslist, tok);
+		build_tree(ccsfd, &root, NULL, NULL/*curr*/, rulelist, reslist, tok);
 
 	} while (!list_done(rulelist, curr));
 
@@ -601,9 +764,9 @@
 			destroy_resource_tree(&(*tree)->rn_child);
 
 		list_remove(tree, node);
-               if(node->rn_actions){
-                       free(node->rn_actions);
-               }
+		if(node->rn_actions){
+			free(node->rn_actions);
+		}
 		free(node);
 	}
 }
@@ -708,6 +871,7 @@
 }
 
 
+#if 0
 static inline int
 _do_child_default_level(resource_node_t **tree, resource_t *first,
 			void *ret, int op)
@@ -744,6 +908,55 @@
 
 	return 0;
 }
+#endif
+
+
+static inline int
+_xx_child_internal(resource_node_t *node, resource_t *first,
+		   resource_node_t *child, void *ret, int op)
+{
+	int x;
+	resource_rule_t *rule = node->rn_resource->r_rule;
+
+	for (x = 0; rule->rr_childtypes &&
+     	     rule->rr_childtypes[x].rc_name; x++) {
+		if (!strcmp(child->rn_resource->r_rule->rr_type,
+			    rule->rr_childtypes[x].rc_name)) {
+			if (rule->rr_childtypes[x].rc_startlevel ||
+			    rule->rr_childtypes[x].rc_stoplevel) {
+				return 0;
+			}
+		}
+	}
+
+	return _res_op_internal(&child, first,
+	 		       child->rn_resource->r_rule->rr_type,
+			       ret, op, child);
+}
+
+
+static inline int
+_do_child_default_level(resource_node_t **tree, resource_t *first,
+			void *ret, int op)
+{
+	resource_node_t *node = *tree, *child;
+	int y, rv = 0;
+
+	if (op == RS_START || op == RS_STATUS) {
+		list_for(&node->rn_child, child, y) {
+			rv = _xx_child_internal(node, first, child, ret, op);
+			if (rv)
+				return rv;
+		}
+	} else {
+		list_for_rev(&node->rn_child, child, y) {
+			rv += _xx_child_internal(node, first, child, ret, op);
+		}
+	}
+
+	return rv;
+}
+
 
 
 
@@ -928,6 +1141,7 @@
 			in the subtree).
    @see			_res_op_by_level res_exec
  */
+#if 0
 int
 _res_op(resource_node_t **tree, resource_t *first,
 	char *type, void * __attribute__((unused))ret, int realop)
@@ -1048,9 +1262,161 @@
 
 	return 0;
 }
+#endif
+
+
+static inline int
+_res_op_internal(resource_node_t **tree, resource_t *first,
+		 char *type, void *__attribute__((unused))ret, int realop,
+		 resource_node_t *node)
+{
+	int rv, me, op;
+
+	/* Restore default operation. */
+	op = realop;
+
+	/* If we're starting by type, do that funky thing. */
+	if (type && strlen(type) &&
+	    strcmp(node->rn_resource->r_rule->rr_type, type))
+		return 0;
+
+	/* If the resource is found, all nodes in the subtree must
+	   have the operation performed as well. */
+	me = !first || (node->rn_resource == first);
+
+	//printf("begin %s: %s %s [0x%x]\n", res_ops[op],
+	       //node->rn_resource->r_rule->rr_type,
+	       //primary_attr_value(node->rn_resource),
+	       //node->rn_flags);
+
+	if (me) {
+		/*
+		   If we've been marked as a node which
+		   needs to be started or stopped, clear
+		   that flag and start/stop this resource
+		   and all resource babies.
+
+		   Otherwise, don't do anything; look for
+		   children with RF_NEEDSTART and
+		   RF_NEEDSTOP flags.
+
+		   CONDSTART and CONDSTOP are no-ops if
+		   the appropriate flag is not set.
+		 */
+	       	if ((op == RS_CONDSTART) &&
+		    (node->rn_flags & RF_NEEDSTART)) {
+			printf("Node %s:%s - CONDSTART\n",
+			       node->rn_resource->r_rule->rr_type,
+			       primary_attr_value(node->rn_resource));
+			op = RS_START;
+		}
+
+		if ((op == RS_CONDSTOP) &&
+		    (node->rn_flags & RF_NEEDSTOP)) {
+			printf("Node %s:%s - CONDSTOP\n",
+			       node->rn_resource->r_rule->rr_type,
+			       primary_attr_value(node->rn_resource));
+			op = RS_STOP;
+		}
+	}
+
+	/* Start starts before children */
+	if (me && (op == RS_START)) {
+		node->rn_flags &= ~RF_NEEDSTART;
+
+		rv = res_exec(node, agent_op_str(op), NULL, 0);
+		if (rv != 0) {
+			node->rn_state = RES_FAILED;
+			return rv;
+		}
+
+		set_time("start", 0, node);
+		clear_checks(node);
+
+		if (node->rn_state != RES_STARTED) {
+			++node->rn_resource->r_incarnations;
+			node->rn_state = RES_STARTED;
+		}
+	} else if (me && (op == RS_STATUS)) {
+		/* Check status before children*/
+		rv = do_status(node);
+		if (rv != 0)
+			return rv;
+	}
+
+	if (node->rn_child) {
+		rv = _res_op_by_level(&node, me?NULL:first, ret, op);
+		if (rv != 0)
+			return rv;
+	}
+
+	/* Stop should occur after children have stopped */
+	if (me && (op == RS_STOP)) {
+		node->rn_flags &= ~RF_NEEDSTOP;
+		rv = res_exec(node, agent_op_str(op), NULL, 0);
+
+		if (rv != 0) {
+			node->rn_state = RES_FAILED;
+			return rv;
+		}
+
+		if (node->rn_state != RES_STOPPED) {
+			--node->rn_resource->r_incarnations;
+			node->rn_state = RES_STOPPED;
+		}
+	}
+
+	//printf("end %s: %s %s\n", res_ops[op],
+	       //node->rn_resource->r_rule->rr_type,
+	       //primary_attr_value(node->rn_resource));
+	
+	return 0;
+}
 
 
 /**
+   Nasty codependent function.  Perform an operation by type for all siblings
+   at some point in the tree.  This allows indirectly-dependent resources
+   (such as IP addresses and user scripts) to have ordering without requiring
+   a direct dependency.
+
+   @param tree		Resource tree to search/perform operations on
+   @param first		Resource we're looking to perform the operation on,
+   			if one exists.
+   @param type		Type to look for.
+   @param ret		Unused, but will be used to store status information
+   			such as resources consumed, etc, in the future.
+   @param realop	Operation to perform if either first is found,
+   			or no first is declared (in which case, all nodes
+			in the subtree).
+   @see			_res_op_by_level res_exec
+ */
+int
+_res_op(resource_node_t **tree, resource_t *first,
+	char *type, void * __attribute__((unused))ret, int realop)
+{
+  	resource_node_t *node;
+ 	int count = 0, rv;
+ 	
+ 	if (realop == RS_STOP) {
+ 		list_for_rev(tree, node, count) {
+ 			rv = _res_op_internal(tree, first, type, ret, realop,
+ 					      node);
+ 			if (rv != 0) 
+ 				return rv;
+ 		}
+ 	} else {
+ 		list_for(tree, node, count) {
+ 			rv = _res_op_internal(tree, first, type, ret, realop,
+ 					      node);
+ 			if (rv != 0) 
+ 				return rv;
+ 		}
+ 	}
+	return 0;
+}
+
+/**
    Start all occurrences of a resource in a tree
 
    @param tree		Tree to search for our resource.
--- cluster/rgmanager/src/daemons/test.c	2007/03/10 00:20:54	1.8
+++ cluster/rgmanager/src/daemons/test.c	2007/03/22 23:46:58	1.9
@@ -49,8 +49,8 @@
 	"\trules\n\n"
 
 
+void _no_op_mode(int);
 void malloc_dump_table(void);
-
 char *agentpath = RESOURCE_ROOTDIR;
 
 
@@ -104,6 +104,7 @@
 }
 
 
+
 int
 test_func(int argc, char **argv)
 {
@@ -356,6 +357,11 @@
 			shift();
 			ret = deps_func(argc, argv);
 			goto out;
+		} else if (!strcmp(argv[1], "noop")) {
+			shift();
+			_no_op_mode(1);
+			ret = test_func(argc, argv);
+			goto out;
 		} else if (!strcmp(argv[1], "rules")) {
 			shift();
 			ret = rules_func(argc, argv);
--- cluster/rgmanager/src/daemons/tests/delta-test016-test017.expected	2007/03/22 23:16:43	1.1
+++ cluster/rgmanager/src/daemons/tests/delta-test016-test017.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,408 @@
+Warning: Max references exceeded for resource address (type ip)
+=== Old Resource List ===
+Resource type: fs
+Instances: 1/1
+Agent: fs.sh
+Attributes:
+  name = mount1 [ primary ]
+  mountpoint = /mnt/cluster [ unique required ]
+  device = /dev/sdb8 [ unique required ]
+  fstype = ext3
+  nfslock [ inherit("nfslock") ]
+
+Resource type: fs
+Instances: 1/1
+Agent: fs.sh
+Attributes:
+  name = mount2 [ primary ]
+  mountpoint = /mnt/cluster2 [ unique required ]
+  device = /dev/sdb9 [ unique required ]
+  fstype = ext3
+  nfslock [ inherit("nfslock") ]
+
+Resource type: ip
+Instances: 1/1
+Agent: ip.sh
+Attributes:
+  address = 192.168.1.3 [ primary unique ]
+  monitor_link = yes
+  nfslock [ inherit("service%nfslock") ]
+
+Resource type: ip
+Instances: 1/1
+Agent: ip.sh
+Attributes:
+  address = 192.168.1.4 [ primary unique ]
+  monitor_link = yes
+  nfslock [ inherit("service%nfslock") ]
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = User group [ primary unique ]
+  target = @users [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,sync
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = Admin group [ primary unique ]
+  target = @admin [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = yellow [ primary unique ]
+  target = yellow [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,no_root_squash
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = magenta [ primary unique ]
+  target = magenta [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,no_root_squash
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = red [ primary unique ]
+  target = red [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw
+
+Resource type: nfsexport
+Agent: nfsexport.sh
+Attributes:
+  name = Dummy Export [ primary ]
+  device [ inherit("device") ]
+  path [ inherit("mountpoint") ]
+  fsid [ inherit("fsid") ]
+
+Resource type: script
+Agent: script.sh
+Attributes:
+  name = initscript [ primary unique ]
+  file = /etc/init.d/sshd [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: service
+Instances: 1/1
+Agent: service.sh
+Attributes:
+  name = test1 [ primary unique required ]
+
+Resource type: service
+Instances: 1/1
+Agent: service.sh
+Attributes:
+  name = test2 [ primary unique required ]
+
+=== New Resource List ===
+Resource type: fs
+Instances: 1/1
+Agent: fs.sh
+Attributes:
+  name = mount1 [ primary ]
+  mountpoint = /mnt/cluster [ unique required ]
+  device = /dev/sdb8 [ unique required ]
+  fstype = ext3
+  nfslock [ inherit("nfslock") ]
+
+Resource type: fs
+Instances: 1/1
+Agent: fs.sh
+Attributes:
+  name = mount2 [ primary ]
+  mountpoint = /mnt/cluster2 [ unique required ]
+  device = /dev/sdb9 [ unique required ]
+  fstype = ext3
+  nfslock [ inherit("nfslock") ]
+
+Resource type: ip
+Instances: 1/1
+Agent: ip.sh
+Attributes:
+  address = 192.168.1.3 [ primary unique ]
+  monitor_link = yes
+  nfslock [ inherit("service%nfslock") ]
+
+Resource type: ip
+Instances: 1/1
+Agent: ip.sh
+Attributes:
+  address = 192.168.1.4 [ primary unique ]
+  monitor_link = yes
+  nfslock [ inherit("service%nfslock") ]
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = User group [ primary unique ]
+  target = @users [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,sync
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = Admin group [ primary unique ]
+  target = @admin [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = yellow [ primary unique ]
+  target = yellow [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,no_root_squash
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = magenta [ primary unique ]
+  target = magenta [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,no_root_squash
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = red [ primary unique ]
+  target = red [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw
+
+Resource type: nfsexport
+Agent: nfsexport.sh
+Attributes:
+  name = Dummy Export [ primary ]
+  device [ inherit("device") ]
+  path [ inherit("mountpoint") ]
+  fsid [ inherit("fsid") ]
+
+Resource type: script
+Agent: script.sh
+Attributes:
+  name = initscript [ primary unique ]
+  file = /etc/init.d/sshd [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: script [NEEDSTART]
+Agent: script.sh
+Attributes:
+  name = script2 [ primary unique ]
+  file = /etc/init.d/script2 [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: script [NEEDSTART]
+Agent: script.sh
+Attributes:
+  name = script3 [ primary unique ]
+  file = /etc/init.d/script3 [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: service
+Instances: 1/1
+Agent: service.sh
+Attributes:
+  name = test1 [ primary unique required ]
+
+Resource type: service
+Instances: 1/1
+Agent: service.sh
+Attributes:
+  name = test2 [ primary unique required ]
+
+=== Old Resource Tree ===
+service {
+  name = "test1";
+  fs {
+    name = "mount1";
+    mountpoint = "/mnt/cluster";
+    device = "/dev/sdb8";
+    fstype = "ext3";
+        nfsexport {
+      name = "Dummy Export";
+      device = "/dev/sdb8";
+      path = "/mnt/cluster";
+            nfsclient {
+        name = "Admin group";
+        target = "@admin";
+        path = "/mnt/cluster";
+                options = "rw";
+      }
+      nfsclient {
+        name = "User group";
+        target = "@users";
+        path = "/mnt/cluster";
+                options = "rw,sync";
+      }
+      nfsclient {
+        name = "red";
+        target = "red";
+        path = "/mnt/cluster";
+                options = "rw";
+      }
+    }
+  }
+  ip [ NEEDSTOP ] {
+    address = "192.168.1.3";
+    monitor_link = "yes";
+      }
+  script {
+    name = "initscript";
+    file = "/etc/init.d/sshd";
+    service_name = "test1";
+  }
+}
+service {
+  name = "test2";
+  fs [ NEEDSTOP ] {
+    name = "mount2";
+    mountpoint = "/mnt/cluster2";
+    device = "/dev/sdb9";
+    fstype = "ext3";
+        nfsexport {
+      name = "Dummy Export";
+      device = "/dev/sdb9";
+      path = "/mnt/cluster2";
+            nfsclient {
+        name = "Admin group";
+        target = "@admin";
+        path = "/mnt/cluster2";
+                options = "rw";
+      }
+      nfsclient {
+        name = "User group";
+        target = "@users";
+        path = "/mnt/cluster2";
+                options = "rw,sync";
+      }
+      nfsclient {
+        name = "red";
+        target = "red";
+        path = "/mnt/cluster2";
+                options = "rw";
+      }
+    }
+  }
+  ip [ NEEDSTOP ] {
+    address = "192.168.1.4";
+    monitor_link = "yes";
+      }
+  script {
+    name = "initscript";
+    file = "/etc/init.d/sshd";
+    service_name = "test2";
+  }
+}
+=== New Resource Tree ===
+service {
+  name = "test1";
+  fs {
+    name = "mount1";
+    mountpoint = "/mnt/cluster";
+    device = "/dev/sdb8";
+    fstype = "ext3";
+        nfsexport {
+      name = "Dummy Export";
+      device = "/dev/sdb8";
+      path = "/mnt/cluster";
+            nfsclient {
+        name = "Admin group";
+        target = "@admin";
+        path = "/mnt/cluster";
+                options = "rw";
+      }
+      nfsclient {
+        name = "User group";
+        target = "@users";
+        path = "/mnt/cluster";
+                options = "rw,sync";
+      }
+      nfsclient {
+        name = "red";
+        target = "red";
+        path = "/mnt/cluster";
+                options = "rw";
+      }
+    }
+  }
+  script {
+    name = "initscript";
+    file = "/etc/init.d/sshd";
+    service_name = "test1";
+  }
+}
+service {
+  name = "test2";
+  script {
+    name = "initscript";
+    file = "/etc/init.d/sshd";
+    service_name = "test2";
+    ip [ NEEDSTART ] {
+      address = "192.168.1.3";
+      monitor_link = "yes";
+          }
+    fs [ NEEDSTART ] {
+      name = "mount2";
+      mountpoint = "/mnt/cluster2";
+      device = "/dev/sdb9";
+      fstype = "ext3";
+            nfsexport {
+        name = "Dummy Export";
+        device = "/dev/sdb9";
+        path = "/mnt/cluster2";
+                nfsclient {
+          name = "Admin group";
+          target = "@admin";
+          path = "/mnt/cluster2";
+                    options = "rw";
+        }
+        nfsclient {
+          name = "User group";
+          target = "@users";
+          path = "/mnt/cluster2";
+                    options = "rw,sync";
+        }
+        nfsclient {
+          name = "red";
+          target = "red";
+          path = "/mnt/cluster2";
+                    options = "rw";
+        }
+      }
+    }
+    script [ NEEDSTART ] {
+      name = "script2";
+      file = "/etc/init.d/script2";
+          }
+    ip [ NEEDSTART ] {
+      address = "192.168.1.4";
+      monitor_link = "yes";
+          }
+  }
+  script [ NEEDSTART ] {
+    name = "script3";
+    file = "/etc/init.d/script3";
+    service_name = "test2";
+  }
+}
--- cluster/rgmanager/src/daemons/tests/test001.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test001.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,3 @@
+Starting test1...
+[start] service:test1
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test001.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test001.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,3 @@
+Stopping test1...
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test002.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test002.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,3 @@
+Starting test1...
+[start] service:test1
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test002.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test002.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,3 @@
+Stopping test1...
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test003.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test003.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,4 @@
+Starting test1...
+[start] service:test1
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test003.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test003.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,4 @@
+Stopping test1...
+[stop] script:initscript
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test004.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test004.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,4 @@
+Starting test1...
+[start] service:test1
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test004.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test004.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,4 @@
+Stopping test1...
+[stop] script:initscript
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test005.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test005.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Starting test1...
+[start] service:test1
+[start] ip:192.168.1.2
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test005.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test005.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.2
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test006.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test006.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Starting test1...
+[start] service:test1
+[start] ip:192.168.1.2
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test006.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test006.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.2
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test007.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test007.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Starting test1...
+[start] service:test1
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test007.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test007.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test008.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test008.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Starting test1...
+[start] service:test1
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test008.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test008.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,5 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test009.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test009.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,6 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test009.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test009.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,6 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test010.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test010.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,6 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test010.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test010.stop.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,6 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test011.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test011.start.expected	2007/03/22 23:46:58	1.2
@@ -0,0 +1,9 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test011.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test011.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,9 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test012.start.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test012.start.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,10 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test012.stop.expected	2007/03/22 23:15:58	1.1
+++ cluster/rgmanager/src/daemons/tests/test012.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,10 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test013.start.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test013.start.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,10 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
--- cluster/rgmanager/src/daemons/tests/test013.stop.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test013.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,10 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
--- cluster/rgmanager/src/daemons/tests/test014.start.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test014.start.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,20 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
+Starting test2...
+[start] service:test2
+[start] fs:mount2
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.4
+[start] script:initscript
+Start of test2 complete
--- cluster/rgmanager/src/daemons/tests/test014.stop.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test014.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,20 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
+Stopping test2...
+[stop] script:initscript
+[stop] ip:192.168.1.4
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount2
+[stop] service:test2
+Stop of test2 complete
--- cluster/rgmanager/src/daemons/tests/test015.start.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test015.start.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,20 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
+Starting test2...
+[start] service:test2
+[start] fs:mount2
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.4
+[start] script:initscript
+Start of test2 complete
--- cluster/rgmanager/src/daemons/tests/test015.stop.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test015.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,20 @@
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
+Stopping test2...
+[stop] script:initscript
+[stop] ip:192.168.1.4
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount2
+[stop] service:test2
+Stop of test2 complete
--- cluster/rgmanager/src/daemons/tests/test016.start.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test016.start.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,22 @@
+Warning: Max references exceeded for resource address (type ip)
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.3
+[start] script:initscript
+Start of test1 complete
+Warning: Max references exceeded for resource address (type ip)
+Starting test2...
+[start] service:test2
+[start] fs:mount2
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] ip:192.168.1.4
+[start] script:initscript
+Start of test2 complete
--- cluster/rgmanager/src/daemons/tests/test016.stop.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test016.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,22 @@
+Warning: Max references exceeded for resource address (type ip)
+Stopping test1...
+[stop] script:initscript
+[stop] ip:192.168.1.3
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
+Warning: Max references exceeded for resource address (type ip)
+Stopping test2...
+[stop] script:initscript
+[stop] ip:192.168.1.4
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount2
+[stop] service:test2
+Stop of test2 complete
--- cluster/rgmanager/src/daemons/tests/test017.conf	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test017.conf	2007/03/22 23:46:59	1.2
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+	Lots of needstarts/needstops; this one is meant to test the ordering 
+	of untyped resources.  In the test 2 service, the start/stop ordering
+	should be:
+
+	start test2
+	start initscript
+	start ip .1.3
+	start mount2
+	start dummy export
+	start admin group
+	start user group
+	start red
+	start script2
+	start .1.4
+	start script3
+
+
+	
+-->
+<cluster>
+<rm>
+	<resources>
+    		<service name="test1"/>
+    		<service name="test2"/>
+		<script name="initscript" file="/etc/init.d/sshd"/>
+		<script name="script2" file="/etc/init.d/script2"/>
+		<script name="script3" file="/etc/init.d/script3"/>
+		<ip address="192.168.1.3" monitor_link="yes"/>
+		<ip address="192.168.1.4" monitor_link="yes"/>
+    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
+    		<fs fstype="ext3" name="mount2" mountpoint="/mnt/cluster2" device="/dev/sdb9"/>
+		<nfsexport name="Dummy Export"/>
+    		<nfsclient name="User group" target="@users" options="rw,sync"/>
+    		<nfsclient name="Admin group" target="@admin" options="rw"/>
+    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
+    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
+    		<nfsclient name="red" target="red" options="rw"/>
+		
+	</resources>
+	<service ref="test1">
+		<script ref="initscript"/>
+		<fs ref="mount1">
+			<nfsexport ref="Dummy Export">
+				<nfsclient ref="Admin group"/>
+				<nfsclient ref="User group"/>
+				<nfsclient ref="red"/>
+			</nfsexport>
+		</fs>
+	</service>
+	<service ref="test2">
+		<script ref="initscript">
+			<ip ref="192.168.1.3"/>
+			<fs ref="mount2">
+				<nfsexport ref="Dummy Export">
+					<nfsclient ref="Admin group"/>
+					<nfsclient ref="User group"/>
+					<nfsclient ref="red"/>
+				</nfsexport>
+			</fs>
+			<script ref="script2"/>
+			<ip ref="192.168.1.4"/>
+		</script>
+		<script ref="script3"/>
+	</service>
+</rm>
+</cluster>
--- cluster/rgmanager/src/daemons/tests/test017.expected	2007/03/22 23:16:43	1.1
+++ cluster/rgmanager/src/daemons/tests/test017.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,215 @@
+=== Resources List ===
+Resource type: fs
+Instances: 1/1
+Agent: fs.sh
+Attributes:
+  name = mount1 [ primary ]
+  mountpoint = /mnt/cluster [ unique required ]
+  device = /dev/sdb8 [ unique required ]
+  fstype = ext3
+  nfslock [ inherit("nfslock") ]
+
+Resource type: fs
+Instances: 1/1
+Agent: fs.sh
+Attributes:
+  name = mount2 [ primary ]
+  mountpoint = /mnt/cluster2 [ unique required ]
+  device = /dev/sdb9 [ unique required ]
+  fstype = ext3
+  nfslock [ inherit("nfslock") ]
+
+Resource type: ip
+Instances: 1/1
+Agent: ip.sh
+Attributes:
+  address = 192.168.1.3 [ primary unique ]
+  monitor_link = yes
+  nfslock [ inherit("service%nfslock") ]
+
+Resource type: ip
+Instances: 1/1
+Agent: ip.sh
+Attributes:
+  address = 192.168.1.4 [ primary unique ]
+  monitor_link = yes
+  nfslock [ inherit("service%nfslock") ]
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = User group [ primary unique ]
+  target = @users [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,sync
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = Admin group [ primary unique ]
+  target = @admin [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = yellow [ primary unique ]
+  target = yellow [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,no_root_squash
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = magenta [ primary unique ]
+  target = magenta [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw,no_root_squash
+
+Resource type: nfsclient
+Agent: nfsclient.sh
+Attributes:
+  name = red [ primary unique ]
+  target = red [ required ]
+  path [ inherit("path") ]
+  fsid [ inherit("fsid") ]
+  options = rw
+
+Resource type: nfsexport
+Agent: nfsexport.sh
+Attributes:
+  name = Dummy Export [ primary ]
+  device [ inherit("device") ]
+  path [ inherit("mountpoint") ]
+  fsid [ inherit("fsid") ]
+
+Resource type: script
+Agent: script.sh
+Attributes:
+  name = initscript [ primary unique ]
+  file = /etc/init.d/sshd [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: script
+Agent: script.sh
+Attributes:
+  name = script2 [ primary unique ]
+  file = /etc/init.d/script2 [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: script
+Agent: script.sh
+Attributes:
+  name = script3 [ primary unique ]
+  file = /etc/init.d/script3 [ unique required ]
+  service_name [ inherit("service%name") ]
+
+Resource type: service
+Instances: 1/1
+Agent: service.sh
+Attributes:
+  name = test1 [ primary unique required ]
+
+Resource type: service
+Instances: 1/1
+Agent: service.sh
+Attributes:
+  name = test2 [ primary unique required ]
+
+=== Resource Tree ===
+service {
+  name = "test1";
+  fs {
+    name = "mount1";
+    mountpoint = "/mnt/cluster";
+    device = "/dev/sdb8";
+    fstype = "ext3";
+        nfsexport {
+      name = "Dummy Export";
+      device = "/dev/sdb8";
+      path = "/mnt/cluster";
+            nfsclient {
+        name = "Admin group";
+        target = "@admin";
+        path = "/mnt/cluster";
+                options = "rw";
+      }
+      nfsclient {
+        name = "User group";
+        target = "@users";
+        path = "/mnt/cluster";
+                options = "rw,sync";
+      }
+      nfsclient {
+        name = "red";
+        target = "red";
+        path = "/mnt/cluster";
+                options = "rw";
+      }
+    }
+  }
+  script {
+    name = "initscript";
+    file = "/etc/init.d/sshd";
+    service_name = "test1";
+  }
+}
+service {
+  name = "test2";
+  script {
+    name = "initscript";
+    file = "/etc/init.d/sshd";
+    service_name = "test2";
+    ip {
+      address = "192.168.1.3";
+      monitor_link = "yes";
+          }
+    fs {
+      name = "mount2";
+      mountpoint = "/mnt/cluster2";
+      device = "/dev/sdb9";
+      fstype = "ext3";
+            nfsexport {
+        name = "Dummy Export";
+        device = "/dev/sdb9";
+        path = "/mnt/cluster2";
+                nfsclient {
+          name = "Admin group";
+          target = "@admin";
+          path = "/mnt/cluster2";
+                    options = "rw";
+        }
+        nfsclient {
+          name = "User group";
+          target = "@users";
+          path = "/mnt/cluster2";
+                    options = "rw,sync";
+        }
+        nfsclient {
+          name = "red";
+          target = "red";
+          path = "/mnt/cluster2";
+                    options = "rw";
+        }
+      }
+    }
+    script {
+      name = "script2";
+      file = "/etc/init.d/script2";
+          }
+    ip {
+      address = "192.168.1.4";
+      monitor_link = "yes";
+          }
+  }
+  script {
+    name = "script3";
+    file = "/etc/init.d/script3";
+    service_name = "test2";
+  }
+}
--- cluster/rgmanager/src/daemons/tests/test017.start.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test017.start.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,22 @@
+Starting test1...
+[start] service:test1
+[start] fs:mount1
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] script:initscript
+Start of test1 complete
+Starting test2...
+[start] service:test2
+[start] script:initscript
+[start] ip:192.168.1.3
+[start] fs:mount2
+[start] nfsexport:Dummy Export
+[start] nfsclient:Admin group
+[start] nfsclient:User group
+[start] nfsclient:red
+[start] script:script2
+[start] ip:192.168.1.4
+[start] script:script3
+Start of test2 complete
--- cluster/rgmanager/src/daemons/tests/test017.stop.expected	2007/03/22 23:15:59	1.1
+++ cluster/rgmanager/src/daemons/tests/test017.stop.expected	2007/03/22 23:46:59	1.2
@@ -0,0 +1,22 @@
+Stopping test1...
+[stop] script:initscript
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount1
+[stop] service:test1
+Stop of test1 complete
+Stopping test2...
+[stop] script:script3
+[stop] ip:192.168.1.4
+[stop] script:script2
+[stop] nfsclient:red
+[stop] nfsclient:User group
+[stop] nfsclient:Admin group
+[stop] nfsexport:Dummy Export
+[stop] fs:mount2
+[stop] ip:192.168.1.3
+[stop] script:initscript
+[stop] service:test2
+Stop of test2 complete
--- cluster/rgmanager/src/daemons/tests/delta-test007-test008.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test007-test008.expected	2007/03/22 23:46:58	1.4
@@ -29,7 +29,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test008-test009.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test008-test009.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -39,7 +39,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test009-test010.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test009-test010.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -39,7 +39,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test010-test011.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test010-test011.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -47,7 +47,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test011-test012.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test011-test012.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -92,7 +92,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test012-test013.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test012-test013.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -92,7 +92,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test013-test014.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test013-test014.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -92,7 +92,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs [NEEDSTART]
 Instances: 1/1
@@ -102,7 +102,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test014-test015.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test014-test015.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -17,7 +17,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -116,7 +116,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -126,7 +126,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/delta-test015-test016.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/delta-test015-test016.expected	2007/03/22 23:46:58	1.4
@@ -8,7 +8,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -18,7 +18,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
@@ -117,7 +117,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -127,7 +127,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/gentests.sh	2005/01/25 16:45:32	1.1
+++ cluster/rgmanager/src/daemons/tests/gentests.sh	2007/03/22 23:46:58	1.2
@@ -34,6 +34,25 @@
 	echo OK
 done
 
+
+#
+# Start/stop tests (noop)
+#
+for t in $TESTS; do
+	declare SERVICES=$(echo "xpath /cluster/rm/service" | xmllint $t.conf --shell | grep content | cut -f2 -d'=')
+	declare phase svc
+	echo -n "Generating $t exec..."
+	for phase in start stop; do
+		echo -n "$phase..."
+		rm -f $t.$phase.expected
+		for svc in $SERVICES; do
+			../rg_test ../../resources noop $t.conf $phase service $svc >> $t.$phase.expected 2> /dev/null
+		done
+	done
+	echo "OK"
+done
+
+
 #
 # Delta tests
 #
--- cluster/rgmanager/src/daemons/tests/runtests.sh	2007/01/26 21:38:56	1.2
+++ cluster/rgmanager/src/daemons/tests/runtests.sh	2007/03/22 23:46:58	1.3
@@ -48,6 +48,41 @@
 	echo OK
 done
 
+
+#
+# Start/stop tests (noop)
+#
+for t in $TESTS; do
+	declare SERVICES=$(echo "xpath /cluster/rm/service" | xmllint $t.conf --shell | grep content | cut -f2 -d'=')
+	declare phase svc
+	echo -n "  Checking $t.conf..."
+	for phase in start stop; do
+		echo -n "$phase..."
+		rm -f $t.$phase.out
+		for svc in $SERVICES; do
+			../rg_test ../../resources noop $t.conf $phase service $svc >> $t.$phase.out 2> $t.$phase.out.stderr
+		done
+		diff -w $t.$phase.expected $t.$phase.out
+		if [ $? -ne 0 ]; then
+			echo "FAILED"
+			echo "*** Start Test $t failed"
+			exit 1
+		fi
+		if grep -q "allocation trace" $t.$phase.out.stderr; then
+			echo "FAILED - memory leak"
+			echo "*** Memory Test $t failed"
+			echo
+			echo Output:
+			echo
+			cat $t.$phase.out.stderr
+			exit 1
+		fi
+		rm -f $t.$phase.out $t.$phase.out.stderr
+	done
+	echo "OK"
+done
+
+
 #
 # Delta tests
 #
--- cluster/rgmanager/src/daemons/tests/test008.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test008.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test009.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test009.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test010.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test010.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test011.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test011.expected	2007/03/22 23:46:58	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test012.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test012.expected	2007/03/22 23:46:59	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test013.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test013.expected	2007/03/22 23:46:59	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test014.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test014.expected	2007/03/22 23:46:59	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -17,7 +17,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test015.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test015.expected	2007/03/22 23:46:59	1.4
@@ -7,7 +7,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -17,7 +17,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1
--- cluster/rgmanager/src/daemons/tests/test016.expected	2007/01/26 21:38:56	1.3
+++ cluster/rgmanager/src/daemons/tests/test016.expected	2007/03/22 23:46:59	1.4
@@ -8,7 +8,7 @@
   mountpoint = /mnt/cluster [ unique required ]
   device = /dev/sdb8 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: fs
 Instances: 1/1
@@ -18,7 +18,7 @@
   mountpoint = /mnt/cluster2 [ unique required ]
   device = /dev/sdb9 [ unique required ]
   fstype = ext3
-  nfslock [ inherit("service%nfslock") ]
+  nfslock [ inherit("nfslock") ]
 
 Resource type: ip
 Instances: 1/1


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