Blame SOURCES/bz1781427-rabbitmq-cluster-delete-nodename-when-stop-fails.patch

bef3ec
From 47d75f8de9dc912da035805f141c674885ce432f Mon Sep 17 00:00:00 2001
bef3ec
From: John Eckersberg <jeckersb@redhat.com>
bef3ec
Date: Thu, 16 Jan 2020 10:20:59 -0500
bef3ec
Subject: [PATCH] rabbitmq-cluster: ensure we delete nodename if stop action
bef3ec
 fails
bef3ec
bef3ec
If the stop action fails, we want to remove the nodename from the crm
bef3ec
attribute.  Currently it is possible for the stop action to fail but
bef3ec
the rabbitmq server does actually stop.  This leaves the attribute
bef3ec
still present.  This means if the entire rabbitmq cluster is stopped,
bef3ec
it is not possible to start the cluster again because the first node
bef3ec
to start will think there is at least one other node running.  Then
bef3ec
the node tries to join an existing cluster instead of rebootstrapping
bef3ec
the cluster from a single node.
bef3ec
---
bef3ec
 heartbeat/rabbitmq-cluster | 2 ++
bef3ec
 1 file changed, 2 insertions(+)
bef3ec
bef3ec
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
bef3ec
index 7837e9e3c..a9ebd37ad 100755
bef3ec
--- a/heartbeat/rabbitmq-cluster
bef3ec
+++ b/heartbeat/rabbitmq-cluster
bef3ec
@@ -552,6 +552,7 @@ rmq_stop() {
bef3ec
 
bef3ec
 	if [ $rc -ne 0 ]; then
bef3ec
 		ocf_log err "rabbitmq-server stop command failed: $RMQ_CTL stop, $rc"
bef3ec
+		rmq_delete_nodename
bef3ec
 		return $rc
bef3ec
 	fi
bef3ec
 
bef3ec
@@ -565,6 +566,7 @@ rmq_stop() {
bef3ec
 			break
bef3ec
 		elif [ "$rc" -ne $OCF_SUCCESS ]; then
bef3ec
 			ocf_log info "rabbitmq-server stop failed: $rc"
bef3ec
+			rmq_delete_nodename
bef3ec
 			exit $OCF_ERR_GENERIC
bef3ec
 		fi
bef3ec
 		sleep 1