Force stop a single node pacemaker on yum update

Currently package updates won't occur on a single node
non-HA pacemaker managed Controller because stopping
the node loses the quorum of 1.

This change gets the count of current nodes in the cluster and
if the count is 1 then specify --force when doing a pcs cluster stop.

Change-Id: I0de2488e24f1ef53a935dbc90ec6de6142bb4264
This commit is contained in:
Steve Baker 2015-10-01 10:17:29 +13:00
parent 3fd199d8e7
commit 77e8ec22a9

View File

@ -44,7 +44,13 @@ pacemaker_status=$(systemctl is-active pacemaker)
if [[ "$pacemaker_status" == "active" ]] ; then if [[ "$pacemaker_status" == "active" ]] ; then
echo "Pacemaker running, stopping cluster node and doing full package update" echo "Pacemaker running, stopping cluster node and doing full package update"
pcs cluster stop node_count=$(pcs status xml | grep -o "<nodes_configured.*/>" | grep -o 'number="[0-9]*"' | grep -o "[0-9]*")
if [[ "$node_count" == "1" ]] ; then
echo "Active node count is 1, stopping node with --force"
pcs cluster stop --force
else
pcs cluster stop
fi
else else
echo "Excluding upgrading packages that are handled by config management tooling" echo "Excluding upgrading packages that are handled by config management tooling"
command_arguments="$command_arguments --skip-broken" command_arguments="$command_arguments --skip-broken"