Managing changes in a cluster by using a quorum leader

If a role is associated with a cluster, meaning more than one software instance, you can define one or more instances as the quorum leader to coordinate changes to all members the cluster.

About this task

For example, in the IBM® WebSphere® Application Server plug-in (plugin.com.ibm.was), the quorum number is set to 1 in the virtual machine template.
"roles": [
   {
      "plugin": "$provider.getPluginScope()",
      "name": "WAS",
      "type": "WAS",
      "quorum": 1,

This setting means that in a deployed WebSphere Application Server cluster, only one instance is elected as the quorum leader.

In the lifecycle scripts, maestro.peers can be used to obtain peer role information. If an instance in the cluster has a value of QUORUM for the key QUORUM, that instance is the quorum leader.
role = maestro.role
peers = maestro.peers
node = maestro.node
parms = maestro.parms
role_status = maestro.role_status

def isQuorum( r=role ):
    return r.get('QUORUM') == 'QUORUM'

logger.debug('quorum leader: %s', isQuorum())

if role_status != 'INSTALLING' and role_status != 'CONFIGURING' and role_status != 'INITIAL' \
    and not isQuorum(role) and not maestro.node['template']['scaling']['max'] == 1:
    for p in peers:
        if isQuorum(peers[p]):
            # update local SSL key
            break

When Secure Socket Layer (SSL) keys are generated for the WebSphere Application Server cluster, the keys must be synchronized across all instances that are associated with the WAS role. The command to generate the keys is run against the quorum leader only. The remaining instances receive notification about the change from the quorum leader, accept the change, and update their local SSL keys.

Maestro.role is a read/write Python dictionary for each role instance to store data. Data from all scripts that is stored in maestro.role is preserved when a virtual machine restarts so that this data can be accessed after the restart. Maestro.peers is a read-only dictionary that contains the role data for all the other peers, which are noted by the fully qualified role name. A fully qualified role name is vm-template-name.instance-id.role-name. maestro.node['id'] is the server name, which is vm-template-name.instance-id. If a peer role changes its role data, all its peers are notified by an invocation of their role/changed.py script.