cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Jan Pokorný <jpokorny@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCHv3 3/6] rgmanager: ra2rng.xsl: common params: prevent misleading combination
Date: Mon,  9 Dec 2013 15:12:35 +0100	[thread overview]
Message-ID: <1386598355-14369-1-git-send-email-jpokorny@redhat.com> (raw)
In-Reply-To: <1386263590-18108-1-git-send-email-jpokorny@redhat.com>

...both @__max_restarts and @__restart_expire_time have "nonzero" values,
otherwise, otherwise if either of the parameter is present, it has to have
"zero" value.

Every other occurrence of these two interconnected parameters for
particular resource is a configuration defect, as it could lead
to false assumption that one will take effect even without the
other defined and nonzero.

Reference:
>		if (restart_expire_time == 0 || max_restarts == 0)
>			return;
>		goto out_assign;
[https://git.fedorahosted.org/cgit/cluster.git/tree/rgmanager/src/daemons/restree.c?h=RHEL64#n538]

Signed-off-by: Jan Pokorn? <jpokorny@redhat.com>
---
 rgmanager/src/resources/ra2rng.xsl | 45 +++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/rgmanager/src/resources/ra2rng.xsl b/rgmanager/src/resources/ra2rng.xsl
index 27105a0..2579952 100644
--- a/rgmanager/src/resources/ra2rng.xsl
+++ b/rgmanager/src/resources/ra2rng.xsl
@@ -26,12 +26,45 @@
     <optional>
         <attribute name="__failure_expire_time" rha:description="Amount of time before a failure is forgotten."/>
     </optional>
-    <optional>
-        <attribute name="__max_restarts" rha:description="Maximum number restarts for an independent subtree before giving up."/>
-    </optional>
-    <optional>
-        <attribute name="__restart_expire_time" rha:description="Amount of time before a failure is forgotten for an independent subtree."/>
-    </optional>
+    <choice datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+        <!--
+            __max_restarts and __restart_expire_time only make sense
+            when defined altogether and contain valid non-zero value
+          -->
+        <group>
+            <attribute name="__max_restarts" rha:description="Maximum number restarts for an independent subtree before giving up.">
+                <data type="int">
+                    <param name="minExclusive">0</param>
+                </data>
+            </attribute>
+            <attribute name="__restart_expire_time" rha:description="Amount of time before a failure is forgotten for an independent subtree.">
+                <data type="string">
+                    <param name="pattern">.*[1-9][0-9]*([SsMmHhDdWwYy].*|)</param>
+                </data>
+            </attribute>
+        </group>
+        <group>
+            <optional>
+                <attribute name="__max_restarts">
+                    <!-- while negative value is not a strict error as it is
+                         silently turned to zero, don't promote such a liberty
+                      -->
+                    <value type="int">0</value>
+                </attribute>
+            </optional>
+            <optional>
+                <attribute name="__restart_expire_time">
+                    <data type="string">
+                        <except>
+                            <data type="string">
+                                <param name="pattern">.*[1-9][0-9]*([SsMmHhDdWwYy].*|)</param>
+                            </data>
+                        </except>
+                    </data>
+                </attribute>
+            </optional>
+        </group>
+    </choice>
 </int:common-optional-parameters>
 
 <xsl:variable name="SP" select="' '"/>
-- 
1.8.1.4



      reply	other threads:[~2013-12-09 14:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 18:26 [Cluster-devel] [resource-agents][PATCH 0/6] rgmanager: ra2rng.xsl: build up param datatyping infra Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 1/6] rgmanager: ra2rng.xsl: extend infrastructure for XML Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 2/6] rgmanager: ra2rng.xsl: make common params reuse XML pretty-print Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 3/6] rgmanager: ra2rng.xsl: common params: prevent misleading combination Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 4/6] rgmanager: ra2rng.xsl: control flow branches common business merge Jan Pokorný
2013-12-09 14:14   ` [Cluster-devel] [PATCHv2 " Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 5/6] rgmanager: ra2rng.xsl: infra for param value datatyping/restriction Jan Pokorný
2013-12-09 14:15   ` [Cluster-devel] [PATCHv2 " Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 6/6] gmanager: ra2rng.xsl: script-file: try to prevent cluster's services Jan Pokorný
2013-12-03 18:31   ` Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 6/6] rgmanager: " Jan Pokorný
2013-12-04 13:50   ` [Cluster-devel] [PATCHv2 " Jan Pokorný
2013-12-09 14:16     ` [Cluster-devel] [PATCHv3 " Jan Pokorný
2013-12-05 17:13 ` [Cluster-devel] [PATCHv2 3/6] rgmanager: ra2rng.xsl: common params: prevent misleading combination Jan Pokorný
2013-12-09 14:12   ` Jan Pokorný [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386598355-14369-1-git-send-email-jpokorny@redhat.com \
    --to=jpokorny@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).