...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ý <jpoko...@redhat.com>
---
 rgmanager/src/resources/ra2rng.xsl | 47 +++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 6 deletions(-)

diff --git a/rgmanager/src/resources/ra2rng.xsl 
b/rgmanager/src/resources/ra2rng.xsl
index 27105a0..5addc47 100644
--- a/rgmanager/src/resources/ra2rng.xsl
+++ b/rgmanager/src/resources/ra2rng.xsl
@@ -26,12 +26,47 @@
     <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">
+                    <data type="int">
+                        <!-- while negative value is not a strict error as
+                             it is silently turned to zero, don't promote
+                             such a liberty -->
+                        <param name="enumeration">0</param>
+                    </data>
+                </attribute>
+            </optional>
+            <optional>
+                <attribute name="__restart_expire_time">
+                    <data type="string">
+                        <exclude>
+                            <data type="string">
+                                <param 
name="pattern">.*[1-9][0-9]*([SsMmHhDdWwYy].*|)</param>
+                            </data>
+                        </exclude>
+                    </data>
+                </attribute>
+            </optional>
+        </group>
+    </choice>
 </int:common-optional-parameters>
 
 <xsl:variable name="SP" select="' '"/>
-- 
1.8.1.4

Reply via email to