Parsers for the Corosync Cluster Engine configurations

Parsers included in this module are:

CoroSyncConfig - file /etc/sysconfig/corosync

CorosyncConf - file /etc/corosync/corosync.conf

class insights.parsers.corosync.CoroSyncConfig(*args, **kwargs)[source]

Bases: insights.core.SysconfigOptions

Warning

This parser is deprecated, please use insights.parsers.sysconfig.CorosyncSysconfig instead.

This parser reads the /etc/sysconfig/corosync file. It uses the SysconfigOptions parser class to convert the file into a dictionary of options. It also provides the options property as a helper to retrieve the COROSYNC_OPTIONS variable.

Sample data:

# Corosync init script configuration file

# COROSYNC_INIT_TIMEOUT specifies number of seconds to wait for corosync
# initialization (default is one minute).
COROSYNC_INIT_TIMEOUT=60

# COROSYNC_OPTIONS specifies options passed to corosync command
# (default is no options).
# See "man corosync" for detailed descriptions of the options.
COROSYNC_OPTIONS=""

Examples

>>> 'COROSYNC_OPTIONS' in csconfig.data
True
>>> csconfig.options
''
property options

The value of the COROSYNC_OPTIONS variable.

Type

(str)

class insights.parsers.corosync.CorosyncConf(context)[source]

Bases: insights.core.ConfigParser

Parse the output of the file /etc/corosync/corosync.conf using the ConfigParser base class. It exposes the corosync configuration through the parsr query interface.

The parameters in the directives are referred from the manpage of corosync.conf. See man 8 corosync.conf for more info.

Sample content of the file /etc/corosync/corosync.conf

totem {
    version: 2
    secauth: off
    cluster_name: tripleo_cluster
    transport: udpu
    token: 10000
}

nodelist {
    node {
        ring0_addr: overcloud-controller-0
        nodeid: 1
    }

    node {
        ring0_addr: overcloud-controller-1
        nodeid: 2
    }

    node {
        ring0_addr: overcloud-controller-2
        nodeid: 3
    }
}

quorum {
    provider: corosync_votequorum
}

logging {
    to_logfile: yes
    logfile: /var/log/cluster/corosync.log
    to_syslog: yes
}

Example

>>> from insights.parsr.query import first, last
>>> corosync_conf['quorum']['provider'][first].value
'corosync_votequorum'
>>> corosync_conf['totem']['token'][first].value
10000
>>> corosync_conf['nodelist']['node']['nodeid'][last].value
3