diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2016-01-25 21:19:13 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2016-02-01 23:53:44 +0100 |
commit | 078e2ddb34db88f222b225444f2333ab34a91662 (patch) | |
tree | 91a6ea0622ae56eb8c3691d8d07a0090039336b3 | |
parent | 40045e4615a7b6f117575ac94c4c10950f682e0c (diff) | |
download | clufter-078e2ddb34db88f222b225444f2333ab34a91662.tar.gz clufter-078e2ddb34db88f222b225444f2333ab34a91662.tar.xz clufter-078e2ddb34db88f222b225444f2333ab34a91662.zip |
filters: handle empty restricted failover domains correctly
- raise a warning in ccs-revitalize filter
- do a proper job in cibcompact2cib filter (during conversion)
See <http://oss.clusterlabs.org/pipermail/users/2016-January/002176.html>.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r-- | filters/cib/configuration/__init__.py | 31 | ||||
-rw-r--r-- | filters/cluster/rm/failoverdomains/__init__.py | 23 |
2 files changed, 44 insertions, 10 deletions
diff --git a/filters/cib/configuration/__init__.py b/filters/cib/configuration/__init__.py index cd06a7d..e7017c0 100644 --- a/filters/cib/configuration/__init__.py +++ b/filters/cib/configuration/__init__.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- -# Copyright 2015 Red Hat, Inc. +# Copyright 2016 Red Hat, Inc. # Part of clufter project # Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt) __author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" @@ -142,14 +142,27 @@ cibcompact2cib = ('''\ <rule id="CONSTRAINT-LOCATION-{$Resource/@id}-RESTRICTED" boolean-op="and" score="-INFINITY"> - <xsl:for-each select="$FailoverDomain/meta_attributes/nvpair[ - starts-with(@name, 'failoverdomainnode-') - ]"> - <expression id="CONSTRAINT-LOCATION-{$Resource/@id}-RESTRICTED-{@value}-expr" - attribute="#uname" - operation="ne" - value="{@value}"/> - </xsl:for-each> + <xsl:choose> + <xsl:when test="$FailoverDomain/meta_attributes/nvpair[ + starts-with(@name, 'failoverdomainnode-') + ]"> + <xsl:for-each select="$FailoverDomain/meta_attributes/nvpair[ + starts-with(@name, 'failoverdomainnode-') + ]"> + <expression id="CONSTRAINT-LOCATION-{$Resource/@id}-RESTRICTED-{@value}-expr" + attribute="#uname" + operation="ne" + value="{@value}"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <!-- see filters/ccs-revitalize[failoverdomains]: + warn on empty restricted failoverdomains --> + <expression id="CONSTRAINT-LOCATION-{$Resource/@id}-RESTRICTED-all-expr" + attribute="#uname" + operation="defined"/> + </xsl:otherwise> + </xsl:choose> </rule> </xsl:if> </rsc_location> diff --git a/filters/cluster/rm/failoverdomains/__init__.py b/filters/cluster/rm/failoverdomains/__init__.py index 299b1f1..6923c51 100644 --- a/filters/cluster/rm/failoverdomains/__init__.py +++ b/filters/cluster/rm/failoverdomains/__init__.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- -# Copyright 2015 Red Hat, Inc. +# Copyright 2016 Red Hat, Inc. # Part of clufter project # Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt) __author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" @@ -19,4 +19,25 @@ ccs_revitalize = '''\ ' with repeated name (', @name, ')')"/> </xsl:message> </xsl:template> + <!-- warn on empty restricted failoverdomains + rgmanager/src/daemons/groups.c:consider_start:instead of start req. + http://oss.clusterlabs.org/pipermail/users/2016-January/002176.html + --> + <xsl:template match="failoverdomain[ + @restricted != '' + and + contains('123456789', + substring(@restricted, 1, 1)) + and + not(failoverdomainnode) + ]"> + <xsl:message> + <xsl:value-of select="concat('WARNING: empty restricted failoverdomain', + ' means associated resource groups', + ' will not start (', @name, ')')"/> + </xsl:message> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> ''' |