How to set the pacemaker cluster name with pcs

clustercorosyncpacemaker

I'm running two pacemaker clusters on the corosync stack on CentOS 7 with all packages up to date with the distro release/updates packages.

Both clusters shows no cluster name with the command pcs status:
Like this:

Cluster name:
Last updated: Mon Nov  3 09:55:58 2014
Last change: Fri Oct 31 11:09:22 2014 via cibadmin on beaker
Stack: corosync
Current DC: scooter (2) - partition with quorum
Version: 1.1.10-32.el7_0.1-368c726
5 Nodes configured
21 Resources configured

There is a cluster_name: entry in the totem section of /etc/corosync/corosync.conf, but I can't find anything related to the cluster name in the pacemaker CIB.

The clusters were created with pcs cluster setup --name clustername node1 node2 node3 node4 node5 (with clustername being the intended name of the cluster).

The /etc/corosync/corosync.conf is world-readable, as well as the directories above it.

Best Answer

In the sources of pcs-0.9.115-32.el7 the getClusterName function is implemented:

def getClusterName():
    if is_rhel6():
        try:
            dom = parse(settings.cluster_conf_file)
        except (IOError,xml.parsers.expat.ExpatError):
            return ""

        return dom.documentElement.getAttribute("name")
    else:
        try:
            f = open(settings.corosync_conf_file,'r')
        except IOError as e:
            return ""

        p = re.compile('cluster_name: *(.*)')
        for line in f:
            m = p.match(line)
            if m:
                return m.group(1)

    return ""

This function check for rhel6 to extract the cluster name from /etc/cluster/cluster.conf (attribute name) or in other case from /etc/corosync/corosync.conf.

The regular expression expected at least one space between cluster_name and name ('cluster_name: *(.*)') in corosync.conf file, maybe this is the problem.


def is_rhel6():
    try:
        issue = open('/etc/system-release').read()
    except IOError as e:
        return False

    if re.search(r'(Red Hat Enterprise Linux Server|CentOS|Scientific Linux) release 6\.', issue):
        return True
    else:
        return False

Check if exist file /etc/corosync/corosync.conf with the proper permissions. I think this bug can be relevant for you: https://bugzilla.redhat.com/show_bug.cgi?id=1094812 and https://bugzilla.redhat.com/show_bug.cgi?id=1029129

I hope this help.

Related Topic