summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-12-15 19:34:31 +0100
committerJan Pokorný <jpokorny@redhat.com>2015-12-17 23:38:51 +0100
commitd41ae9bd69ec2d2b1622e134ead4dedf21bf0907 (patch)
tree0d6bd8bb704c262311902196516a9f2b6199aa54
parent634c3dcc1126f33ca44ed302c43499f12c35656d (diff)
downloadclufter-d41ae9bd69ec2d2b1622e134ead4dedf21bf0907.tar.gz
clufter-d41ae9bd69ec2d2b1622e134ead4dedf21bf0907.tar.xz
clufter-d41ae9bd69ec2d2b1622e134ead4dedf21bf0907.zip
ccs-flatten: inject also resource-specific action stanzas
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--__root__/ccs-flatten/restree.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/__root__/ccs-flatten/restree.c b/__root__/ccs-flatten/restree.c
index 1da90d5..96ddfee 100644
--- a/__root__/ccs-flatten/restree.c
+++ b/__root__/ccs-flatten/restree.c
@@ -1,5 +1,5 @@
/*
- Copyright Red Hat, Inc. 2004-2006
+ Copyright 2015 Red Hat, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -60,6 +60,7 @@ res_do_flatten(xmlNode ** xpp, xmlNode * rmp, resource_node_t * node, const char
xmlNode *n, *r;
resource_attr_t *ra;
resource_t *res = node->rn_resource;
+ resource_act_t *acts = node->rn_actions;
char *val;
char buf[256];
int x, y;
@@ -72,6 +73,36 @@ res_do_flatten(xmlNode ** xpp, xmlNode * rmp, resource_node_t * node, const char
xmlSetProp(n, (xmlChar *) "rgmanager-meta-primary",
(xmlChar *) primary_attr_name(res));
+ /* set actions explicitly */
+ for (x = 0; acts[x].ra_name; x++) {
+ if (acts[x].ra_timeout < 0 && acts[x].ra_interval < 0)
+ continue;
+ /* blacklist some effective non-actions */
+ if (!strcmp(acts[x].ra_name, "meta-data")
+ || !strcmp(acts[x].ra_name, "validate-all"))
+ continue;
+
+ r = xmlNewNode(NULL, (xmlChar *) "action");
+ xmlSetProp(r, (xmlChar *) "name", (xmlChar *) acts[x].ra_name);
+
+ if (acts[x].ra_timeout >= 0) {
+ snprintf(buf, sizeof(buf), "%ld", acts[x].ra_timeout);
+ xmlSetProp(r, (xmlChar *) "timeout", (xmlChar *) buf);
+ }
+ if (acts[x].ra_interval >= 0) {
+ snprintf(buf, sizeof(buf), "%ld", acts[x].ra_interval);
+ xmlSetProp(r, (xmlChar *) "interval", (xmlChar *) buf);
+ }
+ if ((!strcmp(acts[x].ra_name, "status")
+ || !strcmp(acts[x].ra_name, "monitor"))
+ && acts[x].ra_depth >= 0) {
+ snprintf(buf, sizeof(buf), "%d", acts[x].ra_depth);
+ xmlSetProp(r, (xmlChar *) "depth", (xmlChar *) buf);
+ }
+
+ xmlAddChild(n, r);
+ }
+
/* Multiple-instance resources must be decomposed into separate
resources */
if (res->r_refs > 1) {