Force stop a single node pacemaker on yum update
authorSteve Baker <sbaker@redhat.com>
Wed, 30 Sep 2015 21:17:29 +0000 (10:17 +1300)
committerSteve Baker <sbaker@redhat.com>
Thu, 1 Oct 2015 02:40:55 +0000 (15:40 +1300)
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

extraconfig/tasks/yum_update.sh

index eaeb7ef..9125ca0 100755 (executable)
@@ -44,7 +44,13 @@ pacemaker_status=$(systemctl is-active pacemaker)
 
 if [[ "$pacemaker_status" == "active" ]] ; then
     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
     echo "Excluding upgrading packages that are handled by config management tooling"
     command_arguments="$command_arguments --skip-broken"