rabbitmq-server/pull-request-24.patch
Dirk Mueller ba4a22848a Accepting request 485761 from home:vuntz:branches:network:messaging:amqp
- Stop shipping rabbitmq-server OCF resource agent as source file
  while it's included in the upstream tarball. Add patches for code
  that was specific to our variant; they now got upstreamed, but
  are not in this version of rabbitmq yet: pull-request-20.patch
  and pull-request-21.patch.
- Also package the rabbitmq-server-ha OCF resource agent as it
  seems to be more appropriate for clustering. Add upstream fixes
  for making it more solid: pull-request-24.patch and
  pull-request-25.patch.
- Ship an example of /etc/rabbitmq/rabbitmq-env.conf, as this is
  useful indication. It only contains commented examples, based on
  what the Debian package is doing.

OBS-URL: https://build.opensuse.org/request/show/485761
OBS-URL: https://build.opensuse.org/package/show/network:messaging:amqp/rabbitmq-server?expand=0&rev=76
2017-04-05 11:33:01 +00:00

75 lines
3.5 KiB
Diff

From 525eaba13a395550b0711751c16732197ff4dc9e Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@suse.com>
Date: Fri, 31 Mar 2017 13:05:51 +0200
Subject: [PATCH] OCF RA: Add default_vhost parameter to rabbitmq-server-ha.ocf
This enables the cluster to focus on a vhost that is not /, in case the
most important vhost is something else.
For reference, other vhosts may exist in the cluster, but these are not
guaranteed to not suffer from any data loss. This patch doesn't address
this issue.
Closes https://github.com/rabbitmq/rabbitmq-server-release/issues/22
---
scripts/rabbitmq-server-ha.ocf | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
index 49f3af7..c5c2ebf 100755
--- a/scripts/rabbitmq-server-ha.ocf
+++ b/scripts/rabbitmq-server-ha.ocf
@@ -42,6 +42,7 @@ OCF_RESKEY_mnesia_base_default="/var/lib/rabbitmq/mnesia"
OCF_RESKEY_mnesia_schema_base_default="/var/lib/rabbitmq"
OCF_RESKEY_host_ip_default="127.0.0.1"
OCF_RESKEY_node_port_default=5672
+OCF_RESKEY_default_vhost_default="/"
OCF_RESKEY_erlang_cookie_default=false
OCF_RESKEY_erlang_cookie_file_default="/var/lib/rabbitmq/.erlang.cookie"
OCF_RESKEY_use_fqdn_default=false
@@ -67,6 +68,7 @@ OCF_RESKEY_rmq_feature_local_list_queues_default=true
: ${OCF_RESKEY_mnesia_schema_base=${OCF_RESKEY_mnesia_schema_base_default}}
: ${OCF_RESKEY_pid_file=${OCF_RESKEY_pid_file_default}}
: ${OCF_RESKEY_node_port=${OCF_RESKEY_node_port_default}}
+: ${OCF_RESKEY_default_vhost=${OCF_RESKEY_default_vhost_default}}
: ${OCF_RESKEY_erlang_cookie=${OCF_RESKEY_erlang_cookie_default}}
: ${OCF_RESKEY_erlang_cookie_file=${OCF_RESKEY_erlang_cookie_file_default}}
: ${OCF_RESKEY_use_fqdn=${OCF_RESKEY_use_fqdn_default}}
@@ -262,6 +264,18 @@ ${OCF_RESKEY_binary} should listen on this port
<content type="boolean" default="${OCF_RESKEY_node_port_default}" />
</parameter>
+<parameter name="default_vhost" unique="0" required="0">
+<longdesc lang="en">
+Default virtual host used for monitoring if a node is fully synchronized with
+the rest of the cluster. In normal operation, the resource agent will wait for
+queues from this virtual host on this node to be synchronized elsewhere before
+stopping RabbitMQ. This also means queues in other virtual hosts may not be
+fully synchronized on stop operations.
+</longdesc>
+<shortdesc lang="en">Default virtual host used for waiting for synchronization</shortdesc>
+<content type="string" default="${OCF_RESKEY_default_vhost_default}" />
+</parameter>
+
<parameter name="erlang_cookie" unique="0" required="0">
<longdesc lang="en">
Erlang cookie for clustering. If specified, will be updated at the mnesia reset
@@ -1491,7 +1505,7 @@ wait_sync() {
opt_arg="--local"
fi
- queues="${COMMAND_TIMEOUT} ${OCF_RESKEY_ctl} list_queues $opt_arg name state"
+ queues="${COMMAND_TIMEOUT} ${OCF_RESKEY_ctl} -p ${OCF_RESKEY_default_vhost} list_queues $opt_arg name state"
su_rabbit_cmd -t "${wait_time}" "sh -c \"while ${queues} | grep -q 'syncing,'; \
do sleep 2; done\""
@@ -1793,7 +1807,7 @@ node_health_check_legacy() {
local queues
local rc_queues
local timeout_queues
- queues=`su_rabbit_cmd "${OCF_RESKEY_ctl} -q list_queues memory messages consumer_utilisation"`
+ queues=`su_rabbit_cmd "${OCF_RESKEY_ctl} -q -p ${OCF_RESKEY_default_vhost} list_queues memory messages consumer_utilisation"`
rc_queues=$?
check_timeouts $rc_queues "rabbit_list_queues_timeouts" "list_queues"
timeout_queues=$?