Skip to contentSkip to conversation

rgmanager: ra2rng.xsl: MYSQL+APACHE+LVM params datatyping

PATCH New Jan Pokorný 1 participant 4 messages Dec 9, 2013

lore
Share & tools
lore
#0 lore raw

cover rgmanager: ra2rng.xsl: MYSQL+APACHE+LVM params datatyping

In line with previous changeset [1] (and the infrastructure built in preceding [2]), extend parameters validation for these RAs:
* mysql
* apache
* lvm
by datatyping and otherwise restricting them.

It becomes apparent that more and more params with the same properties are shared across various RAs, hence more and more of them are likely to be moved to WILDCARD section with forthcoming progress.

Note to [1]+[2]: due to two intermediate steps to get resulting
cluster.rng (furthermore composed from various components' input), some mistakes/bad decisions were not discovered until more "integration" testing was performed --> this explains why there were so many reiterations of these previous changes, and the last version per each change can now be considered final

[1] http://www.redhat.com/archives/cluster-devel/2013-December/msg00052.html
[2] http://www.redhat.com/archives/cluster-devel/2013-December/msg00037.html

Jan Pokorn? (3):
rgmanager: ra2rng.xsl: mysql-*: datatype/restrict the params
rgmanager: ra2rng.xsl: apache-*: datatype/restrict the params
rgmanager: ra2rng.xsl: lvm-*: datatype/restrict the params

 rgmanager/src/resources/ra2rng.xsl | 122 +++++++++++++++++++++++++++++++++----
 1 file changed, 109 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/3 rgmanager: ra2rng.xsl: mysql-*: datatype/restrict the params

---
 rgmanager/src/resources/ra2rng.xsl | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
rgmanager/src/resources/ra2rng.xsl +40 -0
index 9ee83d0..4cce0da 100644
@@ -204,6 +204,46 @@
             </data>
         </int:parameter>
     </int:agent>
+    <!-- MYSQL -->
+    <int:agent name="mysql">
+        <!-- int:parameter name="name"/ -->
+        <int:parameter name="config_file">
+            <data type="string">
+                <!-- only enforce starting with slash and@the very least
+                     one non-zero length component (otherwise not sane);
+                     maximum path length is as per PATH_MAX - 1 (4095)
+                     from /usr/include/linux/limits.h; spaces allowed -->
+                <param name="pattern">/[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">4095</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="listen_address">
+            <data type="string">
+                <!-- can be either IP (v4 only?) address or a hostname;
+                     as per netware/mysqld_safe.c limited by PATH_MAX -->
+                <param name="pattern">[\p{IsBasicLatin}\p{IsLatin-1Supplement}-[\s]]+</param>
+                <param name="maxLength">4095</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="mysqld_options">
+            <data type="token">
+                <!-- let's limit it@least by $(getconf ARG_MAX) - 1 bytes -->
+                <param name="pattern">[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">2621440</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="startup_wait">
+            <data type="int">
+                <param name="minInclusive">0</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="shutdown_wait">
+            <data type="int">
+                <param name="minInclusive">0</param>
+            </data>
+        </int:parameter>
+        <!-- int:parameter name="service_name"/ -->
+    </int:agent>
 </int:agent-parameter-specialization>
 
 <xsl:variable name="SP" select="' '"/>
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 2/3 rgmanager: ra2rng.xsl: apache-*: datatype/restrict the params

In reply to Jan Pokorný

Note that this patch effectively limits the liberty that I found was expected at least in one case [1]:

Quoted 2 lines

<apache config_file="/etc/apache2/apache2.conf" httpd_options=""
name="debby" server_root="/var/www/html" shutdown_wait=""/>

i.e., empty shutdown_wait, but it seems reasonable to require either the parameter is defined and then it has *valid* value, or not defined at all, that is, to put some boundaries on what is considered a canonical form (note: mentioned case can be trivially promoted to such a form using, e.g., XSLT, but it should be a responsibility of the tooling, not a validator, really).

[1] http://www.redhat.com/archives/linux-cluster/2011-October/msg00035.html

---
 rgmanager/src/resources/ra2rng.xsl | 44 +++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 5 deletions(-)
rgmanager/src/resources/ra2rng.xsl +39 -5
index 4cce0da..f2cd56f 100644
@@ -26,6 +26,44 @@
                 <value type="string">yes</value>
             </choice>
         </int:parameter>
+        <int:parameter name="shutdown_wait">
+            <data type="int">
+                <param name="minInclusive">0</param>
+            </data>
+        </int:parameter>
+    </int:agent>
+    <!-- APACHE (should be named, e.g., httpd, not as per foundation) -->
+    <int:agent name="apache">
+        <!-- int:parameter name="name"/ -->
+        <int:parameter name="server_root">
+            <data type="string">
+                <!-- only enforce starting with slash and@the very least
+                     one non-zero length component (otherwise not sane);
+                     maximum path length is as per PATH_MAX - 1 (4095)
+                     from /usr/include/linux/limits.h; spaces allowed -->
+                <param name="pattern">/[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">4095</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="config_file">
+            <data type="string">
+                <!-- only enforce,@the very least, one non-zero length
+                     component (otherwise not sane);
+                     maximum path length is as per PATH_MAX - 1 (4095)
+                     from /usr/include/linux/limits.h; spaces allowed -->
+                <param name="pattern">[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">4095</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="httpd_options">
+            <data type="token">
+                <!-- let's limit it@least by $(getconf ARG_MAX) - 1 bytes -->
+                <param name="pattern">[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">2621440</param>
+            </data>
+        </int:parameter>
+        <!-- shutdown_wait: see WILDCARD -->
+        <!-- int:parameter name="service_name"/ -->
     </int:agent>
     <!-- FS -->
     <int:agent name="fs">
@@ -237,11 +275,7 @@
                 <param name="minInclusive">0</param>
             </data>
         </int:parameter>
-        <int:parameter name="shutdown_wait">
-            <data type="int">
-                <param name="minInclusive">0</param>
-            </data>
-        </int:parameter>
+        <!-- shutdown_wait: see WILDCARD -->
         <!-- int:parameter name="service_name"/ -->
     </int:agent>
 </int:agent-parameter-specialization>
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 3/3 rgmanager: ra2rng.xsl: lvm-*: datatype/restrict the params

In reply to Jan Pokorný
---
 rgmanager/src/resources/ra2rng.xsl | 48 +++++++++++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 13 deletions(-)
rgmanager/src/resources/ra2rng.xsl +35 -13
index 748d3a1..98de4a5 100644
@@ -26,6 +26,19 @@
                 <value type="string">yes</value>
             </choice>
         </int:parameter>
+        <int:parameter name="self_fence">
+            <choice>
+                <!-- note: a bit stricter than what the code enforces -->
+                <value type="token">0</value>
+                <value type="token">1</value>
+                <value type="token">no</value>
+                <value type="token">yes</value>
+                <value type="token">false</value>
+                <value type="token">true</value>
+                <value type="token">off</value>
+                <value type="token">on</value>
+            </choice>
+        </int:parameter>
         <int:parameter name="shutdown_wait">
             <data type="int">
                 <param name="minInclusive">0</param>
@@ -112,19 +125,7 @@
                 <value type="string">1</value>
             </choice>
         </int:parameter>
-        <int:parameter name="self_fence">
-            <choice>
-                <!-- note: a bit stricter than what the code enforces -->
-                <value type="token">0</value>
-                <value type="token">1</value>
-                <value type="token">no</value>
-                <value type="token">yes</value>
-                <value type="token">false</value>
-                <value type="token">true</value>
-                <value type="token">off</value>
-                <value type="token">on</value>
-            </choice>
-        </int:parameter>
+        <!-- self_fence: see WILDCARD -->
         <!-- nfslock: see WILDCARD -->
         <int:parameter name="nfsrestart">
             <choice>
@@ -229,6 +230,27 @@
             </data>
         </int:parameter>
     </int:agent>
+    <!-- LVM -->
+    <int:agent name="lvm">
+        <!-- int:parameter name="name"/ -->
+        <int:parameter name="vg_name">
+            <data type="string">
+                <!-- would be "token" unless single(?) use that breaks it -->
+                <!-- https://bugzilla.redhat.com/show_bug.cgi?id=747278#c6 -->
+                <param name="pattern">[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">63</param>
+            </data>
+        </int:parameter>
+        <int:parameter name="lv_name">
+            <data type="string">
+                <!-- https://bugzilla.redhat.com/show_bug.cgi?id=747278#c6 -->
+                <param name="pattern">[\p{IsBasicLatin}\p{IsLatin-1Supplement}]+</param>
+                <param name="maxLength">63</param>
+            </data>
+        </int:parameter>
+        <!-- self_fence: see WILDCARD -->
+        <!-- nfslock: see WILDCARD -->
+    </int:agent>
     <!-- SCRIPT -->
     <int:agent name="script">
         <int:parameter name="file">
Signature · 1 line
1.8.1.4