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

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