Blob Blame History Raw
From 42fae88f9b0a998b65883b8cb6148e93d7e9b022 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Fri, 24 Feb 2017 17:39:22 -0500
Subject: [PATCH 300/300] common-ha: setup after teardown often fails

The cleanup logic only removes the corosync files on $this node. If
the files on the other nodes are not removed, some residual state may
be retained that prevents a new setup from coming up successfully.

using `pcs cluster destroy --all` precludes this possibility and
obviates the (error prone) logic to remove the the nodes one by one;
this we can remove the loop where that is done.

HT to Tomas Jelinek in #cluster on IRC

release-3.10 https://review.gluster.org/#/c/16737/
release-3.10 Change-Id: Iff24e3732f91f3b96a0b00b8199aa42446e60938

Change-Id: Ibc0f544fa7685030f09d63f9a033ac45df157839
BUG: 1426324
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/98648
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 extras/ganesha/scripts/ganesha-ha.sh | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index c807610..8f138ef 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -321,24 +321,6 @@ string:"EXPORT(Export_Id=$export_id)" 2>&1)
 
 teardown_cluster()
 {
-    local name=${1}
-
-    for server in ${HA_SERVERS} ; do
-        if [[ ${HA_CLUSTER_NODES} != *${server}* ]]; then
-            logger "info: ${server} is not in config, removing"
-
-            pcs cluster stop ${server} --force
-            if [ $? -ne 0 ]; then
-                logger "warning: pcs cluster stop ${server} failed"
-            fi
-
-            pcs cluster node remove ${server}
-            if [ $? -ne 0 ]; then
-                logger "warning: pcs cluster node remove ${server} failed"
-            fi
-        fi
-    done
-
     # BZ 1193433 - pcs doesn't reload cluster.conf after modification
     # after teardown completes, a subsequent setup will appear to have
     # 'remembered' the deleted node. You can work around this by
@@ -352,7 +334,7 @@ teardown_cluster()
         logger "warning pcs cluster stop --all failed"
     fi
 
-    pcs cluster destroy
+    pcs cluster destroy --all
     if [ $? -ne 0 ]; then
         logger "error pcs cluster destroy failed"
         exit 1
@@ -1046,7 +1028,7 @@ main()
 
         teardown_resources ${HA_SERVERS}
 
-        teardown_cluster ${HA_NAME}
+        teardown_cluster
 
         cleanup_ganesha_config ${HA_CONFDIR}
         ;;
-- 
2.9.3