summaryrefslogtreecommitdiffstats
path: root/filters/corosync/totem/__init__.py
blob: e53f0573c1a73cf9e6a2349cef3bf97520150290 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: UTF-8 -*-
# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)

###

# NOTE pcs doesn't support udpb directly via --transport (unless forced),
#      one has to specify --broadcast0 parameter instead and transport
#      will get silently switched to udpb

from ....utils_xslt import xslt_is_member

needlexml2pcscmd_transports = ('udp', 'udpu')
needlexml2pcscmd_rrp_mode = ('active', 'passive')
# 1:1 mapping of supported params to pcs arguments (not: rrpmode)
needlexml2pcscmd_supported = (
    'consensus',
    'join',
    'token',
    'token_coefficients',
    'fail_recv_const',
    'miss_count_const',
    'token_coefficient',
)

needlexml2pcscmd = '''\
    <!-- transport -->
    <xsl:if test="
''' + (
    xslt_is_member('@transport', needlexml2pcscmd_transports)
) + '''">
        <xsl:value-of select="concat(' --transport ', @transport)"/>
    </xsl:if>

    <!-- rrpmode -->
    <xsl:if test="
''' + (
    xslt_is_member('@rrp_mode', needlexml2pcscmd_rrp_mode)
) + '''">
        <xsl:value-of select="concat(' --rrpmode ', @rrp_mode)"/>
    </xsl:if>

    <clufter:descent-mix at="interface"/>

    <!-- ipv6? -->
    <xsl:if test="@ip_version = 'ipv6'">
        <xsl:value-of select="' --ipv6 '"/>
    </xsl:if>

    <xsl:for-each select="@*[
''' + (
        xslt_is_member('name()', needlexml2pcscmd_supported)
) + ''']">
        <xsl:if test=".">
            <xsl:value-of select="concat(' --', name(), ' ', .)"/>
        </xsl:if>
    </xsl:for-each>
'''