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

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