Blob Blame History Raw
From ba399a083a56963bb7414535ede6eff6afcd1a0a Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Mon, 14 Jun 2021 12:32:06 -0400
Subject: [PATCH 585/585] ganesha_ha: ganesha_grace RA fails in start() and/or
 fails in monitor () (#2523)

shell [[ ]] string compare fails to match returned attr to the
pattern and subsequently returns status of "not running", resulting
in dependencies such as the IPaddr (cluster_ip) RA not starting

Change-Id: I2c8d6f5c4cf0480672d52d8aa0d9226950441dc9
commit 8ec66a43eedd505ec0b40f55c05f13a77fe8074e
PR: https://github.com/gluster/glusterfs/pull/2523
issue: https://github.com/gluster/glusterfs/issues/2522
BUG: 1945143
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/247613
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 extras/ganesha/ocf/ganesha_grace | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/extras/ganesha/ocf/ganesha_grace b/extras/ganesha/ocf/ganesha_grace
index edc6fa2..ca219af 100644
--- a/extras/ganesha/ocf/ganesha_grace
+++ b/extras/ganesha/ocf/ganesha_grace
@@ -122,15 +122,18 @@ ganesha_grace_start()
 
 	# case 1
 	if [[ -z "${attr}" ]]; then
+		ocf_log debug "grace start: returning success case 1"
 		return ${OCF_SUCCESS}
 	fi
 
 	# case 2
-	if [[ "${attr}" = *"value=1" ]]; then
+	if [[ "${attr}" = *"host=\"${host}\" value=\"1\"" ]]; then
+		ocf_log debug "grace start: returning success case 2"
 		return ${OCF_SUCCESS}
 	fi
 
 	# case 3
+	ocf_log info "grace start returning: not running case 3 (${attr})"
 	return ${OCF_NOT_RUNNING}
 }
 
@@ -162,7 +165,7 @@ ganesha_grace_monitor()
 {
 	local host=$(ocf_local_nodename)
 
-	ocf_log debug "ganesha_grace monitor ${host}"
+	ocf_log debug "ganesha_grace_monitor ${host}"
 
 	attr=$(attrd_updater --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null)
         if [ $? -ne 0 ]; then
@@ -174,13 +177,16 @@ ganesha_grace_monitor()
 	# chance to create it. In which case we'll pretend
 	# everything is okay this time around
 	if [[ -z "${attr}" ]]; then
+		ocf_log debug "grace monitor: returning success case 1"
 		return ${OCF_SUCCESS}
 	fi
 
-	if [[ "${attr}" = *"value=1" ]]; then
+	if [[ "${attr}" = *"host=\"${host}\" value=\"1\"" ]]; then
+		ocf_log debug "grace monitor: returning success case 2"
 		return ${OCF_SUCCESS}
 	fi
 
+	ocf_log info "grace monitor: returning not running case 3 (${attr})"
 	return ${OCF_NOT_RUNNING}
 }
 
-- 
1.8.3.1