diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-09-02 23:27:45 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-09-02 23:54:14 +0200 |
commit | 845f619083146b42b27828e39ee813c6f56d840f (patch) | |
tree | d2a2c30dba2063ef8dd680c5cfac8e4b1e86d841 | |
parent | ffee14c17f92f002cf775e2e2c5660117ac39bdf (diff) | |
download | clufter-845f619083146b42b27828e39ee813c6f56d840f.tar.gz clufter-845f619083146b42b27828e39ee813c6f56d840f.tar.xz clufter-845f619083146b42b27828e39ee813c6f56d840f.zip |
ccs-flatten: inject also primary attribute name
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-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) { |