in scripts/HAConfig/HAConfig.py [0:0]
def createCoroSyncConfig(HANAPrimaryInstanceID,HANASecondaryInstanceID,HANASecondaryIPAddress,HANAPrimaryIPAddress,HANAPrimaryCorosync2ndIP,HANASecondaryCorosync2ndIP,AWSRegion):
CommandArray = []
CommandArray.append('echo "# Please read the corosync.conf.5 manual page" > /etc/corosync/corosync.conf')
CommandArray.append('echo "totem {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " version: 2" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " token: 30000" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " consensus: 36000" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " token_retransmits_before_loss_const: 6" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " crypto_cipher: none" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " crypto_hash: none" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " clear_node_high_bit: yes" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " rrp_mode: passive" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " " >> /etc/corosync/corosync.conf')
CommandArray.append('echo " interface {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " ringnumber: 0" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " bindnetaddr: '+HANAPrimaryIPAddress+'" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " mcastport: 5405" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " ttl: 1" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " }" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " transport: udpu" >> /etc/corosync/corosync.conf')
CommandArray.append('echo "}" >> /etc/corosync/corosync.conf')
CommandArray.append('echo "logging {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " fileline: off" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " to_logfile: yes" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " to_syslog: yes" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " logfile: /var/log/cluster/corosync.log" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " debug: off" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " timestamp: on" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " logger_subsys {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " subsys: QUORUM" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " debug: off" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " }" >> /etc/corosync/corosync.conf')
CommandArray.append('echo "}" >> /etc/corosync/corosync.conf')
CommandArray.append('echo "nodelist {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " node {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " ring0_addr: '+HANAPrimaryIPAddress+'" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " ring1_addr: '+HANAPrimaryCorosync2ndIP+'" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " nodeid: 1" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " }" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " node {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " ring0_addr: '+HANASecondaryIPAddress+'" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " ring1_addr: '+HANASecondaryCorosync2ndIP+'" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " nodeid: 2" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " }" >> /etc/corosync/corosync.conf')
CommandArray.append('echo "}" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " " >> /etc/corosync/corosync.conf')
CommandArray.append('echo " quorum {" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " # Enable and configure quorum subsystem (default: off)" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " # see also corosync.conf.5 and votequorum.5" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " provider: corosync_votequorum" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " expected_votes: 2" >> /etc/corosync/corosync.conf')
CommandArray.append('echo " two_node: 1" >> /etc/corosync/corosync.conf')
CommandArray.append('echo "}" >> /etc/corosync/corosync.conf')
CommandArray.append('chown root:root /etc/corosync/corosync.conf')
CommandArray.append('chmod 400 /etc/corosync/corosync.conf')
CommentStr = 'CoroSync cofigfile on Primary'
InstanceIDArray =[HANAPrimaryInstanceID]
if ( executeSSMCommands(CommandArray,InstanceIDArray,CommentStr,AWSRegion) == 1 ):
CommandArray[13]=None
CommandArray[13]='echo " bindnetaddr: '+HANASecondaryIPAddress+'" >> /etc/corosync/corosync.conf'
CommentStr = 'CoroSync cofigfile on Secondary'
InstanceIDArray =[HANASecondaryInstanceID]
return executeSSMCommands(CommandArray,InstanceIDArray,CommentStr,AWSRegion)
else:
return 0