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 | |
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>
-rwxr-xr-x | __root__/run-check | 7 | ||||
-rw-r--r-- | filters/cib/configuration/resources/__init__.py | 55 | ||||
-rw-r--r-- | filters/cluster/rm/__init__.py | 25 | ||||
-rw-r--r-- | tests/filters/ccsflat2cibprelude.py | 5 |
4 files changed, 90 insertions, 2 deletions
diff --git a/__root__/run-check b/__root__/run-check index 12f2d3f..81bc86f 100755 --- a/__root__/run-check +++ b/__root__/run-check @@ -104,6 +104,9 @@ EOF <instance_attributes id="RESOURCE-ip-192.168.0.128-ATTRS"> <nvpair id="RESOURCE-ip-192.168.0.128-ATTRS-ip" name="ip" value="192.168.0.128"/> </instance_attributes> + <operations> + <op id="RESOURCE-ip-192.168.0.128-OP-monitor" name="monitor" interval="20s"/> + </operations> </primitive> <!-- mimic NOFAILBACK failoverdomain (FAILOVERDOMAIN-failover_domain1)--> <meta_attributes id="SERVICE-mm-META-ATTRS-nofailback"> @@ -226,7 +229,9 @@ pcs -f tmp-cib.xml stonith create FENCEDEV-xvm fence_xvm \\ pcmk_host_map=rhel6-node1:rhel6-node1,rhel6-node2:rhel6-node2 pcs -f tmp-cib.xml \\ resource create RESOURCE-ip-192.168.0.128 ocf:heartbeat:IPaddr2 \\ - ip=192.168.0.128 + ip=192.168.0.128 \\ + op monitor id=RESOURCE-ip-192.168.0.128-OP-monitor name=monitor \\ + interval=20s pcs -f tmp-cib.xml \\ resource group add SERVICE-mm-GROUP RESOURCE-ip-192.168.0.128 pcs -f tmp-cib.xml \\ 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}"/--> diff --git a/tests/filters/ccsflat2cibprelude.py b/tests/filters/ccsflat2cibprelude.py index 3e30640..09348af 100644 --- a/tests/filters/ccsflat2cibprelude.py +++ b/tests/filters/ccsflat2cibprelude.py @@ -27,6 +27,7 @@ class FiltersCcsFlat2CibPreludeTestCase(TeardownFilterTestCase): </instance_attributes> <meta_attributes id="RESOURCE-nfsclient-test1-META"> <nvpair id="RESOURCE-nfsclient-test1-META-service" name="rgmanager-service" value="RESOURCES-"/> + <nvpair id="RESOURCE-nfsclient-test1-META-monitor" name="rgmanager-monitor" value="60s"/> </meta_attributes> </primitive> '''), @@ -43,6 +44,7 @@ class FiltersCcsFlat2CibPreludeTestCase(TeardownFilterTestCase): </instance_attributes> <meta_attributes id="RESOURCE-nfsclient-test2-META"> <nvpair id="RESOURCE-nfsclient-test2-META-service" name="rgmanager-service" value="RESOURCES-"/> + <nvpair id="RESOURCE-nfsclient-test2-META-monitor" name="rgmanager-monitor" value="60s"/> </meta_attributes> </primitive> '''), @@ -75,6 +77,7 @@ class FiltersCcsFlat2CibPreludeTestCase(TeardownFilterTestCase): </instance_attributes> <meta_attributes id="RESOURCE-SAPDatabase-SAP1-META"> <nvpair id="RESOURCE-SAPDatabase-SAP1-META-service" name="rgmanager-service" value="RESOURCES-"/> + <nvpair id="RESOURCE-SAPDatabase-SAP1-META-monitor" name="rgmanager-monitor" value="60s"/> </meta_attributes> </primitive> '''), @@ -90,6 +93,7 @@ class FiltersCcsFlat2CibPreludeTestCase(TeardownFilterTestCase): </instance_attributes> <meta_attributes id="RESOURCE-SAPDatabase-GT1-META"> <nvpair id="RESOURCE-SAPDatabase-GT1-META-service" name="rgmanager-service" value="RESOURCES-"/> + <nvpair id="RESOURCE-SAPDatabase-GT1-META-monitor" name="rgmanager-monitor" value="60s"/> </meta_attributes> </primitive> '''), @@ -122,6 +126,7 @@ class FiltersCcsFlat2CibPreludeTestCase(TeardownFilterTestCase): </instance_attributes> <meta_attributes id="RESOURCE-SAPInstance-GT1_foobar-META"> <nvpair id="RESOURCE-SAPInstance-GT1_foobar-META-service" name="rgmanager-service" value="RESOURCES-"/> + <nvpair id="RESOURCE-SAPInstance-GT1_foobar-META-monitor" name="rgmanager-monitor" value="60s"/> </meta_attributes> </primitive> '''), |