Blob Blame History Raw
From ba6480523b5e9e4fc27cb180fab29b536d277322 Mon Sep 17 00:00:00 2001
From: Kaleb S KEITHLEY <kkeithle@redhat.com>
Date: Tue, 17 May 2016 17:44:24 -0400
Subject: [PATCH 168/178] common-ha: stonith-enabled option set error in new pacemaker

Setting the option too early results in an error in newer versions
of pacemaker. Postpone setting the option in order for it to succeed.

N.B. We do not use a fencing agent. Yes, we know this is "not supported."

access attempts, e.g. `pcs property set stonith-enabled=false`
will fail (or time out) if attempted "too early", i.e. before
the cluster has elected its DC.

see https://bugzilla.redhat.com/show_bug.cgi?id=1336947#c3 and
https://bugzilla.redhat.com/show_bug.cgi?id=1320740

Backport of
> mainline http://review.gluster.org/14426
> BZ 1336945
> release-3.8 http://review.gluster.org/14427
> BZ 1336947
> release-3.7 http://review.gluster.org/14428
> BZ 1336948

Change-Id: Ie0ad8b593270fc4ad0cd64bd03336efc5c08ff00
BUG: 1334092
Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/74545
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
---
 extras/ganesha/scripts/ganesha-ha.sh |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 33affe9..f0796d2 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -182,7 +182,14 @@ setup_cluster()
         exit 1;
     fi
 
-    sleep 3
+    sleep 1
+    # wait for the cluster to elect a DC before querying or writing
+    # to the CIB. BZ 1334092
+    crmadmin --dc_lookup --timeout=5000 > /dev/null 2>&1
+    while [ $? -ne 0 ]; do
+        crmadmin --dc_lookup --timeout=5000 > /dev/null 2>&1
+    done
+
     unclean=$(pcs status | grep -u "UNCLEAN")
     while [[ "${unclean}X" = "UNCLEANX" ]]; do
          sleep 1
@@ -196,6 +203,7 @@ setup_cluster()
             logger "warning: pcs property set no-quorum-policy=ignore failed"
         fi
     fi
+
     pcs property set stonith-enabled=false
     if [ $? -ne 0 ]; then
         logger "warning: pcs property set stonith-enabled=false failed"
@@ -213,9 +221,6 @@ setup_finalize_ha()
          sleep 1
          stopped=$(pcs status | grep -u "Stopped")
     done
-
-    # pcs resource cleanup
-
 }
 
 
-- 
1.7.1