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

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