diff options
-rw-r--r-- | __root__/ccs-flatten/reslist.c | 18 | ||||
-rw-r--r-- | __root__/ccs-flatten/reslist.h | 1 | ||||
-rw-r--r-- | __root__/ccs-flatten/restree.c | 3 |
3 files changed, 22 insertions, 0 deletions
diff --git a/__root__/ccs-flatten/reslist.c b/__root__/ccs-flatten/reslist.c index cf65ce8..d75a961 100644 --- a/__root__/ccs-flatten/reslist.c +++ b/__root__/ccs-flatten/reslist.c @@ -146,6 +146,24 @@ primary_attr_value(resource_t * res) return NULL; } +char * +primary_attr_name(resource_t * res) +{ + int x; + resource_attr_t *ra; + + for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) { + ra = &res->r_attrs[x]; + + if (!(ra->ra_flags & RA_PRIMARY)) + continue; + + return ra->ra_name; + } + + return NULL; +} + /** Find a resource given its reference. A reference is the value of the primary attribute. diff --git a/__root__/ccs-flatten/reslist.h b/__root__/ccs-flatten/reslist.h index caa0453..c7f69f2 100644 --- a/__root__/ccs-flatten/reslist.h +++ b/__root__/ccs-flatten/reslist.h @@ -199,6 +199,7 @@ void destroy_resource(resource_t * res); char *attr_value(resource_node_t * node, const char *attrname); char *res_attr_value(resource_t * res, const char *attrname); char *primary_attr_value(resource_t *); +char *primary_attr_name(resource_t *); void *act_dup(resource_act_t * acts); #endif /* _RESLIST_H */ diff --git a/__root__/ccs-flatten/restree.c b/__root__/ccs-flatten/restree.c index 0c9cb14..1da90d5 100644 --- a/__root__/ccs-flatten/restree.c +++ b/__root__/ccs-flatten/restree.c @@ -69,6 +69,9 @@ res_do_flatten(xmlNode ** xpp, xmlNode * rmp, resource_node_t * node, const char xmlSetProp(n, (xmlChar *) "rgmanager-meta-agent", (xmlChar *) basename(res->r_rule->rr_agent)); + xmlSetProp(n, (xmlChar *) "rgmanager-meta-primary", + (xmlChar *) primary_attr_name(res)); + /* Multiple-instance resources must be decomposed into separate resources */ if (res->r_refs > 1) { |