Fix pacemaker cluster configuration

* replaces crm with crm_attribute, crm is a separate tool which is not
  available for redhat distros. crm_attribute should be available in all
  supported distros.
* cluster configuration is done only once on bootstrap host
* adds sleep to let pacemaker start up properly

Change-Id: Ie14fd68a49d7312d3817c25a305eca7a2aa9c9cf
This commit is contained in:
Jan Provaznik 2014-07-07 09:21:27 -04:00
parent 891abca31d
commit 4ded514788
3 changed files with 15 additions and 6 deletions

View File

@ -1,4 +1,5 @@
corosync
os-apply-config
os-is-bootstrap-host
os-refresh-config
os-svc-install

View File

@ -4,3 +4,9 @@ set -eux
os-svc-enable -n pacemaker
os-svc-restart -n pacemaker
# Give pacemaker some time to boot up, otherwise configuration commands
# time out. The issue is tracked here:
# https://bugzilla.redhat.com/show_bug.cgi?id=1111747
# This workaround can be removed once the issue above is fixed.
sleep 30

View File

@ -2,10 +2,12 @@
set -eu
QUORUM_POLICY=$(os-apply-config --key pacemaker.quorum_policy --type raw --key-default ignore)
RECHECK_INTERVAL=$(os-apply-config --key pacemaker.recheck_interval --type raw --key-default 5)
STONITH_ENABLED=$(os-apply-config --key pacemaker.stonith_enabled --type raw --key-default false)
if os-is-bootstrap-host; then
QUORUM_POLICY=$(os-apply-config --key pacemaker.quorum_policy --type raw --key-default ignore)
RECHECK_INTERVAL=$(os-apply-config --key pacemaker.recheck_interval --type raw --key-default 5)
STONITH_ENABLED=$(os-apply-config --key pacemaker.stonith_enabled --type raw --key-default false)
crm configure property no-quorum-policy=$QUORUM_POLICY \
cluster-recheck-interval=$RECHECK_INTERVAL"min" \
stonith-enabled=$STONITH_ENABLED
crm_attribute -t crm_config -n stonith-enabled -v $STONITH_ENABLED
crm_attribute -t crm_config -n no-quorum-policy -v $QUORUM_POLICY
crm_attribute -t crm_config -n cluster-recheck-interval -v "${RECHECK_INTERVAL}min"
fi