diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-12-16 18:38:43 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-12-17 23:39:01 +0100 |
commit | 47d3d0143ff0bc9255dddc5a552938b1d30ebfd0 (patch) | |
tree | 732fdeab00b3ef3817735031c9ca7860a184b684 /filters | |
parent | 131830b15b88575d2550b3c5329b1fe923bcba39 (diff) | |
download | clufter-47d3d0143ff0bc9255dddc5a552938b1d30ebfd0.tar.gz clufter-47d3d0143ff0bc9255dddc5a552938b1d30ebfd0.tar.xz clufter-47d3d0143ff0bc9255dddc5a552938b1d30ebfd0.zip |
filters~ccs2pcs: propagate "monitor" op for primitives
For this monitor operation, either use the interval as designated in the
original rgmanager agent (sticking with the most basic=lowest depth only),
or use the default of 60 seconds (the same is automatically injected as
a default by pcs).
Resolves: <https://bugzilla.redhat.com/1272570>.
Also adjust the (unit) tests respectively.
Reported-by: Miroslav Lisik <mlisik@redhat.com>
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'filters')
-rw-r--r-- | filters/cib/configuration/resources/__init__.py | 55 | ||||
-rw-r--r-- | filters/cluster/rm/__init__.py | 25 |
2 files changed, 79 insertions, 1 deletions
diff --git a/filters/cib/configuration/resources/__init__.py b/filters/cib/configuration/resources/__init__.py index 468b023..4494567 100644 --- a/filters/cib/configuration/resources/__init__.py +++ b/filters/cib/configuration/resources/__init__.py @@ -315,7 +315,6 @@ cibprelude2cibcompact = ('''\ ]/@id ] ]"/> - ''') % dict(package_name=package_name()) ### @@ -547,3 +546,57 @@ cib_meld_templates = ('''\ </xsl:copy> </xsl:template> ''') + +### + +cibcompact2cib = ('''\ + <!-- propagate monitor operation info to proper operations stanza ... --> + <xsl:template match="primitive[ + meta_attributes/nvpair/@name = 'rgmanager-monitor' + ]"> + <xsl:variable name="Monitor" + select="meta_attributes/nvpair[ + @name = 'rgmanager-monitor' + ]"/> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:for-each select="*[name() != 'utilization']"> + <xsl:choose> + <xsl:when test="name() = 'meta_attributes' + and + count(*) = count(nvpair[@name = 'rgmanager-monitor'])"/> + <xsl:when test="name() = 'meta_attributes'"> + <xsl:copy> + <xsl:apply-templates select="@*|*[ + name() != 'nvpair' + or + @name != 'rgmanager-monitor' + ]"/> + </xsl:copy> + </xsl:when> + <xsl:when test="name() = 'operations'"> + <xsl:copy> + <xsl:apply-templates select="@*|*"/> + <op id="{concat(@id, '-OP-monitor')}" + name="monitor" + interval="{$Monitor/@value}"/> + </xsl:copy> + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select="@*|*"/> + </xsl:copy> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:if test="not(operations)"> + <operations> + <op id="{concat(@id, '-OP-monitor')}" + name="monitor" + interval="{$Monitor/@value}"/> + </operations> + </xsl:if> + <xsl:apply-templates select="utilization"/> + </xsl:copy> + </xsl:template> +''') diff --git a/filters/cluster/rm/__init__.py b/filters/cluster/rm/__init__.py index cec8f59..4b22889 100644 --- a/filters/cluster/rm/__init__.py +++ b/filters/cluster/rm/__init__.py @@ -189,6 +189,31 @@ ccsflat2cibprelude = ('''\ '-', ../@name )}"/> + <xsl:variable name="IntervalFound" + select="action[ + @name = 'monitor' + and + not(preceding-sibling::action[ + @name = 'monitor' + and + @depth < current()/@depth + ]) + and + not(following-sibling::action[ + @name = 'monitor' + and + @depth < current()/@depth + ]) + ]/@interval"/> + <xsl:variable name="Interval"> + <xsl:value-of select="$IntervalFound"/> + <xsl:if test="not($IntervalFound)"> + <xsl:value-of select="'60'"/> + </xsl:if> + </xsl:variable> + <nvpair id="{$Prefix}-META-monitor" + name="rgmanager-monitor" + value="{concat($Interval, 's')}"/> <!--nvpair id="{$Prefix}-META-domain" name="rgmanager-domain" value="{../@domain}"/--> |