diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-12-09 19:53:36 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-12-17 23:37:51 +0100 |
commit | d07679839da91eabfe68083d6197b3e00db9479b (patch) | |
tree | cbb89c4521fbd0f15b9d1362dc0cac2009390af1 /filters/cib | |
parent | e74ab411f7e693f4c0b0927453c8e6504ee4c51f (diff) | |
download | clufter-d07679839da91eabfe68083d6197b3e00db9479b.tar.gz clufter-d07679839da91eabfe68083d6197b3e00db9479b.tar.xz clufter-d07679839da91eabfe68083d6197b3e00db9479b.zip |
filters/cib2pcscmd[crm_config]: be picky about the properties
E.g., do not propagate the "implicit" ones like dc-version
or cluster-infrastructure.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'filters/cib')
-rw-r--r-- | filters/cib/configuration/crm_config/__init__.py | 67 |
1 files changed, 58 insertions, 9 deletions
diff --git a/filters/cib/configuration/crm_config/__init__.py b/filters/cib/configuration/crm_config/__init__.py index 151d359..51a1e67 100644 --- a/filters/cib/configuration/crm_config/__init__.py +++ b/filters/cib/configuration/crm_config/__init__.py @@ -7,7 +7,40 @@ __author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" ### from ....filters._2pcscmd import verbose_ec_test, verbose_inform -from ....utils_xslt import NL +from ....utils_xslt import NL, xslt_is_member + +# http://clusterlabs.org/doc/en-US/Pacemaker/1.1-pcs/html-single/Pacemaker_Explained/#_cluster_options +cib2pcscmd_whitelist = ( + 'no-quorum-policy', + 'batch-limit', + 'migration-limit', + 'symmetric-cluster', + 'stop-all-resources', + 'stop-orphan-resources', + 'stop-orphan-actions', + 'start-failure-is-fatal', + 'enable-startup-probes', + 'maintenance-mode', + 'stonith-enabled', + 'stonith-action', + 'stonith-timeout', + 'cluster-delay', + 'dc-deadtime', + 'cluster-recheck-interval', + 'pe-error-series-max', + 'pe-warn-series-max', + 'pe-input-series-max', + 'remove-after-stop', + 'startup-fencing', + #'election-timeout', + #'shutdown-escalation', + #'crmd-integration-timeout', + #'crmd-finalization-timeout', + 'crmd-transition-delay', + #'default-resource-stickiness', + #'is-managed-default', + #'default-action-timeout', +) cib2pcscmd = ('''\ <xsl:for-each select="cluster_property_set"> @@ -15,18 +48,34 @@ cib2pcscmd = ('''\ <!-- unfortunately pcs will throw away the rest of name-value pairs when first unknown observed; alternatively a single command with "force" --> + <xsl:choose> + <xsl:when test=" +''' + ( + xslt_is_member('@name', cib2pcscmd_whitelist) +) + '''"> ''' + ( - verbose_inform('"set singleton cluster property: ", @name') + verbose_inform('"set singleton cluster property: ", @name') ) + ''' - <xsl:value-of select='concat($pcscmd_pcs, "property set")'/> - <xsl:if test="$pcscmd_force"> - <xsl:value-of select="' --force'"/> - </xsl:if> - <xsl:value-of select='concat(" '", @name, "=", @value, "'")'/> - <xsl:value-of select="'%(NL)s'"/> + <xsl:value-of select='concat($pcscmd_pcs, "property set")'/> + <xsl:if test="$pcscmd_force"> + <xsl:value-of select="' --force'"/> + </xsl:if> + <xsl:value-of select='concat(" '", @name, "=", @value, "'")'/> + <xsl:value-of select="'%(NL)s'"/> ''' + ( - verbose_ec_test + verbose_ec_test ) + ''' + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:value-of select="concat( + 'WARNING: dropping non-whitelisted cluster property: `', + @name, + '`' + )"/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </xsl:for-each> ''') % dict( |