]> review.fuel-infra Code Review - packages/trusty/rabbitmq-server.git/commitdiff
Tune 3.6.6 for mos7.0. 76/29176/4
authorAlexey Lebedeff <alebedev@mirantis.com>
Fri, 11 Nov 2016 15:09:04 +0000 (18:09 +0300)
committerAlexey Lebedeff <alebedev@mirantis.com>
Fri, 9 Dec 2016 13:10:24 +0000 (16:10 +0300)
Changes applied on top of upstream .deb package:
- fuel-ha-utils in 7.0 still contain its own copy of OCF script. Replace
  it with the latest version using dpkg-divert mechanism.
- Patch OCF to not to use private pacemaker attributes - pacemaker in
  7.0  doesn't support them
- Upstream OCF script no longer contains HA policies, copy from 8.0
  fuel-library
- Disable broker startup on installation
- Tune fd limit
- Add erlang-src dependency, build fails on ssl headers otherwise

Change-Id: Iaaaec3ed1ef42350d7d84846817be2a7fda8ccbc

debian/changelog
debian/control
debian/patches/policy_location.patch [new file with mode: 0644]
debian/patches/revert_private_attributes.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/postrm.in [changed mode: 0644->0755]
debian/preinst [new file with mode: 0755]
debian/rabbitmq-server.default
debian/rules
scripts/rabbitmq-fuel [new file with mode: 0644]
scripts/set_rabbitmq_policy.sh [new file with mode: 0644]

index 54f3998919f745e5c5703ad8fdfc796f8c2f0fc5..611939af45e944bed6ac527e9a75f25a4424d8f4 100644 (file)
@@ -1,3 +1,9 @@
+rabbitmq-server (3.6.6-1~u14.04+mos1) mos7.0-hotfix; urgency=medium
+
+  * new upstream release
+
+ -- Alexey Lebedeff <alebedev@mirantis.com>  Fri, 11 Nov 2016 15:06:56 +0000
+
 rabbitmq-server (3.6.5.907-1) unstable; urgency=low
 
   * New Upstream Release
index 050051ba3f79db1292009fc44f1d78b7da74a01d..9d89f21a4a047d0c9b46c6819bcd06c8fe2b1572 100644 (file)
@@ -7,18 +7,18 @@ Uploaders: Michael Klishin <michael@rabbitmq.com>,
  Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com>
 Build-Depends: debhelper (>= 9),
  dh-systemd (>= 1.5),
- erlang-dev,
+ erlang-dev, erlang-src,
  python-simplejson,
  xmlto,
  xsltproc,
- erlang-nox (>= 1:16.b.3) | esl-erlang,
+ erlang-nox (>= 18.1) | esl-erlang,
  zip,
  rsync
 Standards-Version: 3.9.4
 
 Package: rabbitmq-server
 Architecture: all
-Depends: erlang-nox (>= 1:16.b.3) | esl-erlang, adduser, logrotate, socat, init-system-helpers (>= 1.13~)
+Depends: erlang-nox (>= 18.1) | esl-erlang, adduser, logrotate, socat, init-system-helpers (>= 1.13~)
 Description: Multi-protocol messaging broker
  RabbitMQ is an open source multi-protocol messaging broker.
 Homepage: http://www.rabbitmq.com/
diff --git a/debian/patches/policy_location.patch b/debian/patches/policy_location.patch
new file mode 100644 (file)
index 0000000..f18c459
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/scripts/rabbitmq-server-ha.ocf
++++ b/scripts/rabbitmq-server-ha.ocf
+@@ -47,7 +47,7 @@ OCF_RESKEY_erlang_cookie_file_default="/
+ OCF_RESKEY_use_fqdn_default=false
+ OCF_RESKEY_fqdn_prefix_default=""
+ OCF_RESKEY_max_rabbitmqctl_timeouts_default=3
+-OCF_RESKEY_policy_file_default="/usr/local/sbin/set_rabbitmq_policy"
++OCF_RESKEY_policy_file_default="/usr/lib/ocf/resource.d/fuel/set_rabbitmq_policy.sh"
+ OCF_RESKEY_rmq_feature_health_check_default=true
+ OCF_RESKEY_rmq_feature_local_list_queues_default=true
diff --git a/debian/patches/revert_private_attributes.patch b/debian/patches/revert_private_attributes.patch
new file mode 100644 (file)
index 0000000..545c859
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/scripts/rabbitmq-server-ha.ocf
++++ b/scripts/rabbitmq-server-ha.ocf
+@@ -1811,7 +1811,7 @@ ocf_get_private_attr() {
+     local attr_default_value="${2:?}"
+     local nodename="${3:-$THIS_PCMK_NODE}"
+     local count
+-    count=$(attrd_updater -p --name "$attr_name" --node "$nodename" --query)
++    count=$(crm_attribute -N "$nodename" -l reboot --name "$attr_name" --query)
+     if [ $? -ne 0 ]; then
+         echo $attr_default_value
+     else
+@@ -1823,7 +1823,7 @@ ocf_update_private_attr() {
+     local attr_name="${1:?}"
+     local attr_value="${2:?}"
+     local nodename="${3:-$THIS_PCMK_NODE}"
+-    ocf_run attrd_updater -p --name "$attr_name" --node "$nodename" --update "$attr_value"
++    ocf_run crm_attribute -N "$nodename" -l reboot --name "$attr_name" --update "$attr_value"
+ }
+ rabbitmqctl_with_timeout_check() {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..f99b7b1
--- /dev/null
@@ -0,0 +1,2 @@
+revert_private_attributes.patch
+policy_location.patch
old mode 100644 (file)
new mode 100755 (executable)
index c2e9bbf..d7b77b2
@@ -60,6 +60,29 @@ esac
 
 #DEBHELPER#
 
-exit 0
 
 
+this_version=3.6.6-1~u14.04+mos1
+diversion_added_version=3.6.6-1~u14.04+mos1
+
+losing_diversion=n
+
+if test "$1" = failed-upgrade
+then
+        dpkg --compare-versions "$2" le-nl "$this_version" ||
+        # An upgrade from a newer version failed.
+        # There is no way for us to know enough to take over from here,
+        # so abort the upgrade.
+        exit 1
+elif dpkg --compare-versions "$2" lt-nl "$diversion_added_version"
+then
+        losing_diversion=y
+fi
+
+case "$1,$losing_diversion" in
+    remove,*|abort-install,*|disappear,*|*,y)
+        dpkg-divert --remove --rename /usr/lib/ocf/resource.d/fuel/rabbitmq-server
+        ;;
+esac
+
+exit 0
diff --git a/debian/preinst b/debian/preinst
new file mode 100755 (executable)
index 0000000..6eba844
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+this_version=3.6.6-1~u14.04+mos1
+diversion_added_version=3.6.6-1~u14.04+mos1
+
+if
+        test "$1" = install ||
+        dpkg --compare-versions "$2" lt "$diversion_added_version" ||
+        dpkg --compare-versions "$this_version" lt "$2"
+then
+    dpkg-divert --add --rename /usr/lib/ocf/resource.d/fuel/rabbitmq-server
+fi
index bde5e308952bfed0aabb86bf525e20d1d2763b7c..3eebe2fab5283d62c11a6b41e3f10e17705e2b44 100644 (file)
@@ -6,4 +6,11 @@
 # to handle many simultaneous connections. Refer to the system
 # documentation for ulimit (in man bash) for more information.
 #
-#ulimit -n 1024
+# Default value is 1024, but it's absolutely unreasonable default in a
+# modern world, as rabbitmq consumes file descriptors for everything:
+# for client connections, for per-queue files, etc. Its documentation
+# recommends to allow for at least 65536 open file descriptors in
+# production. Values were chosen in
+# https://bugs.launchpad.net/fuel/+bug/1279594
+ulimit -H -n 105472
+ulimit -S -n 102400
index 48510ec8a64ae5d4423e14d081e02d83338f2e37..2eef4b265944bf8c0ccc43f1c87a2e5632064dba 100755 (executable)
@@ -50,11 +50,23 @@ override_dh_auto_install:
 
        install -p -D -m 0755 scripts/rabbitmq-server.ocf \
                $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/rabbitmq/rabbitmq-server
+       install -p -D -m 0755 scripts/rabbitmq-fuel \
+               $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/fuel/rabbitmq-server
        install -p -D -m 0755 scripts/rabbitmq-server-ha.ocf \
-               $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/rabbitmq/rabbitmq-server-ha
+               $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/fuel/rabbitmq-server-upstream
+       install -p -D -m 0644 scripts/set_rabbitmq_policy.sh \
+               $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/fuel/set_rabbitmq_policy.sh
 
        rm $(DEB_DESTDIR)$(RMQ_ERLAPP_DIR)/LICENSE* \
                $(DEB_DESTDIR)$(RMQ_ERLAPP_DIR)/INSTALL
 
        rmdir $(DEB_DESTDIR)$(PREFIX)/lib/erlang/lib \
                $(DEB_DESTDIR)$(PREFIX)/lib/erlang
+override_dh_systemd_enable:
+       dh_systemd_enable --no-enable
+
+override_dh_systemd_start:
+       dh_systemd_start --no-start
+
+override_dh_installinit:
+       dh_installinit --noscripts
diff --git a/scripts/rabbitmq-fuel b/scripts/rabbitmq-fuel
new file mode 100644 (file)
index 0000000..eafb073
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+OCF_RESKEY_enable_rpc_ha_default=false
+: ${OCF_RESKEY_enable_rpc_ha=${OCF_RESKEY_enable_rpc_ha_default}}
+
+OCF_RESKEY_enable_notifications_ha_default=true
+: ${OCF_RESKEY_enable_notifications_ha=${OCF_RESKEY_enable_notifications_ha_default}}
+
+read -d '' EXTENDED_OCF_PARAMS << EOF
+<parameter name="enable_rpc_ha" unique="0" required="0">
+<longdesc lang="en">
+Set ha-mode=all policy for RPC queues. Note that Ceilometer queues are not
+affected by this flag.
+</longdesc>
+<shortdesc lang="en">Set ha-mode=all policy for RPC queues</shortdesc>
+<content type="boolean" default="${OCF_RESKEY_enable_rpc_ha_default}" />
+</parameter>
+
+<parameter name="enable_notifications_ha" unique="0" required="0">
+<longdesc lang="en">
+Set ha-mode=all policy for Ceilometer queues. Note that RPC queues are not
+affected by this flag.
+</longdesc>
+<shortdesc lang="en">Set ha-mode=all policy for Ceilometer queues</shortdesc>
+<content type="boolean" default="${OCF_RESKEY_enable_notifications_ha_default}" />
+</parameter>
+EOF
+
+# That is 'rabbitmq' file in the current directory, but it is renamed to
+# rabbitmq-server-upstream during packaging
+#TODO(dmitryme): remove rabbitmq-server-upstream once we switch to
+# rabbitmq-3.5.7, as it will be included here
+upstream_rabbitmq_ocf_script="$(dirname $0)/rabbitmq-server-upstream"
+. $upstream_rabbitmq_ocf_script
diff --git a/scripts/set_rabbitmq_policy.sh b/scripts/set_rabbitmq_policy.sh
new file mode 100644 (file)
index 0000000..8e69182
--- /dev/null
@@ -0,0 +1,30 @@
+# This script is called by rabbitmq-server-ha.ocf during RabbitMQ
+# cluster start up. It is a convenient place to set your cluster
+# policy here, for example:
+# ${OCF_RESKEY_ctl} set_policy ha-all "." '{"ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 0
+
+if [ "${OCF_RESKEY_enable_rpc_ha}" = 'true' ] ; then
+    ${OCF_RESKEY_ctl} set_policy heat_rpc_expire "^heat-engine-listener\\." '{"expires":3600000, "ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 1
+    ${OCF_RESKEY_ctl} set_policy results_expire "^results\\." '{"expires":3600000, "ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 1
+    ${OCF_RESKEY_ctl} set_policy tasks_expire "^tasks\\." '{"expires":3600000, "ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 1
+
+    if [ "${OCF_RESKEY_enable_notifications_ha}" = 'true' ] ; then
+        ocf_log info "${LH} Setting HA policy for all queues"
+        ${OCF_RESKEY_ctl} set_policy ha-all "." '{"ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 0
+    else
+        ocf_log info "${LH} Setting HA policy for all queues except Ceilometer ones"
+        # The regex below matches any string except the ones starting with either of 'event.', 'metering.' or 'notifications.'
+        ${OCF_RESKEY_ctl} set_policy ha-all-except-notif "^((?!(event|metering|notifications)\.).)*$" '{"ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 0
+    fi
+
+else
+    ocf_log info "${LH} Do not set HA policy for all queues"
+    ${OCF_RESKEY_ctl} set_policy heat_rpc_expire "^heat-engine-listener\\." '{"expires":3600000}' --apply-to all --priority 1
+    ${OCF_RESKEY_ctl} set_policy results_expire "^results\\." '{"expires":3600000}' --apply-to all --priority 1
+    ${OCF_RESKEY_ctl} set_policy tasks_expire "^tasks\\." '{"expires":3600000}' --apply-to all --priority 1
+
+    if [ "${OCF_RESKEY_enable_notifications_ha}" = 'true' ] ; then
+        ocf_log info "${LH} Setting HA policy for Ceilometer queues"
+        ${OCF_RESKEY_ctl} set_policy ha-notif "^(event|metering|notifications)\." '{"ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 0
+    fi
+fi