Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 150405 Details for
Bug 212121
rgmanager stops the resources in wrong order
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch
rgmanager-212121-3.patch (text/plain), 21.88 KB, created by
Lon Hohberger
on 2007-03-19 18:29:48 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Lon Hohberger
Created:
2007-03-19 18:29:48 UTC
Size:
21.88 KB
patch
obsolete
>Index: include/list.h >=================================================================== >RCS file: /cvs/cluster/cluster/rgmanager/include/list.h,v >retrieving revision 1.2.2.2 >diff -u -r1.2.2.2 list.h >--- include/list.h 12 May 2006 21:28:30 -0000 1.2.2.2 >+++ include/list.h 19 Mar 2007 18:18:21 -0000 >@@ -29,6 +29,14 @@ > } \ > } while (0) > >+ >+#define list_prepend(list, newnode) \ >+do { \ >+ list_insert(list, newnode); \ >+ *list = newnode; \ >+} while (0) >+ >+ > #define list_remove(list, oldnode) \ > do { \ > if (le(oldnode) == le(*list)) { \ >@@ -46,6 +54,11 @@ > } \ > } while (0) > >+/* >+ list_do(list, node) { >+ stuff; >+ } while (!list_done(list, node)); >+ */ > #define list_do(list, curr) \ > if (*list && (curr = *list)) do > >@@ -53,9 +66,29 @@ > (curr && (((curr = (void *)le(curr)->le_next)) && (curr == *list))) > > /* >- list_do(list, node) { >- stuff; >- } while (!list_done(list, node)); >+ * list_for(list, tmp, counter) { >+ * stuff; >+ * } >+ * >+ * counter = # of items in list when done. >+ * * sets cnt to 0 before even checking list; >+ * * checks for valid list >+ * * traverses list, incrementing counter. If we get to the for loop, >+ * there must be at least one item in the list > */ >+#define list_for(list, curr, cnt) \ >+ if (!(cnt=0) && list && *list) \ >+ for (curr = *list; \ >+ (cnt == 0) || (curr != *list); \ >+ curr = (void*)le(curr)->le_next, \ >+ cnt++) >+ >+#define list_for_rev(list, curr, cnt) \ >+ if (!(cnt=0) && list && *list) \ >+ for (curr = (void *)(le(*list)->le_prev); \ >+ (cnt == 0) || ((void *)curr != le(*list)->le_prev); \ >+ curr = (void*)(le(curr)->le_prev), \ >+ cnt++) >+ > > #endif >Index: include/reslist.h >=================================================================== >RCS file: /cvs/cluster/cluster/rgmanager/include/reslist.h,v >retrieving revision 1.8.2.5 >diff -u -r1.8.2.5 reslist.h >--- include/reslist.h 6 Dec 2005 18:31:42 -0000 1.8.2.5 >+++ include/reslist.h 19 Mar 2007 18:18:21 -0000 >@@ -79,9 +79,10 @@ > > > typedef struct _resource_child { >- char rc_forbid; > int rc_startlevel; > int rc_stoplevel; >+ int rc_forbid; >+ int rc_flags; > char *rc_name; > } resource_child_t; > >Index: src/daemons/reslist.c >=================================================================== >RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/reslist.c,v >retrieving revision 1.6.2.9 >diff -u -r1.6.2.9 reslist.c >--- src/daemons/reslist.c 26 Jan 2007 21:02:27 -0000 1.6.2.9 >+++ src/daemons/reslist.c 19 Mar 2007 18:18:21 -0000 >@@ -391,17 +391,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(node->children->content)+ >+ strlen(node->name)+2; >+ else >+ size = strlen(node->name)+2; >+ nnv = 1; >+ } else { >+ if (node->children && node->children->content) { >+ size = strlen(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; >Index: src/daemons/resrules.c >=================================================================== >RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/resrules.c,v >retrieving revision 1.9.2.6 >diff -u -r1.9.2.6 resrules.c >--- src/daemons/resrules.c 26 Jan 2007 18:59:11 -0000 1.9.2.6 >+++ src/daemons/resrules.c 19 Mar 2007 18:18:21 -0000 >@@ -529,11 +529,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; >@@ -549,6 +550,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; >@@ -565,6 +567,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; >@@ -863,7 +866,7 @@ > */ > if (childname) > store_childtype(&rr->rr_childtypes, childname, >- startlevel, stoplevel, forbid); >+ startlevel, stoplevel, forbid, 0); > } > > return 0; >Index: src/daemons/restree.c >=================================================================== >RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/restree.c,v >retrieving revision 1.10.2.13 >diff -u -r1.10.2.13 restree.c >--- src/daemons/restree.c 3 Nov 2006 16:26:18 -0000 1.10.2.13 >+++ src/daemons/restree.c 19 Mar 2007 18:18:22 -0000 >@@ -42,7 +42,7 @@ > > /* 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); > void print_env(char **env); >@@ -90,6 +90,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 > */ >@@ -359,6 +370,14 @@ > } > #endif > >+#ifdef NO_CCS >+ if (_no_op_mode_) { >+ printf("[%s] %s:%s\n", res_ops[op], >+ res->r_rule->rr_type, res->r_attrs->ra_value); >+ return 0; >+ } >+#endif >+ > childpid = fork(); > if (childpid < 0) { > clulog(LOG_ERR, "%s: fork failed (%d)!\n", __func__, errno); >@@ -443,6 +462,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. >@@ -468,127 +578,173 @@ > char tok[512]; > resource_rule_t *childrule; > resource_node_t *node; >- resource_t *curres; > char *ref; > char *newchild; >- int x, y, flags; >- >- for (x = 1; ; x++) { >+ char *tmp; >+ int ccount = 0, x = 0, y = 0, flags = 0; > >- /* 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; > >- } else { >+ if (rule->rr_childtypes[y].rc_forbid) >+ flags |= RFL_FORBID; > >- 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; >+ } >+ >+ /* 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; > >- } while (!list_done(rulelist, childrule)); >+ /* 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; > } > >@@ -620,7 +776,7 @@ > if (!curr->rr_root) > continue; > >- build_tree(ccsfd, &root, NULL, curr, rulelist, reslist, tok); >+ build_tree(ccsfd, &root, NULL, NULL/*curr*/, rulelist, reslist, tok); > > } while (!list_done(rulelist, curr)); > >@@ -647,9 +803,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); > } > } >@@ -750,6 +906,7 @@ > } > > >+#if 0 > static inline int > _do_child_default_level(resource_node_t **tree, resource_t *first, > void *ret, int op) >@@ -786,6 +943,55 @@ > > return 0; > } >+#endif >+ >+ >+static inline int >+_xx_child_internal(resource_node_t *node, 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, child->rn_resource, >+ 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, child, ret, op); >+ if (rv) >+ return rv; >+ } >+ } else { >+ list_for_rev(&node->rn_child, child, y) { >+ rv += _xx_child_internal(node, child, ret, op); >+ } >+ } >+ >+ return rv; >+} >+ > > > >@@ -970,6 +1176,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) >@@ -1090,7 +1297,159 @@ > > 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, op, 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, op, 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 >Index: src/daemons/test.c >=================================================================== >RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/test.c,v >retrieving revision 1.1.2.3 >diff -u -r1.1.2.3 test.c >--- src/daemons/test.c 21 Mar 2005 22:01:30 -0000 1.1.2.3 >+++ src/daemons/test.c 19 Mar 2007 18:18:22 -0000 >@@ -30,8 +30,8 @@ > "\trules\n\n" > > >+void _no_op_mode(int); > void malloc_dump_table(void); >- > char *agentpath = RESOURCE_ROOTDIR; > > >@@ -59,6 +59,7 @@ > } > > >+ > int > test_func(int argc, char **argv) > { >@@ -277,6 +278,11 @@ > shift(); > ret = test_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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 212121
:
149651
| 150405 |
150702
|
153997