From: Alexey Lebedeff Date: Fri, 11 Nov 2016 15:09:04 +0000 (+0300) Subject: Tune 3.6.6 for mos7.0. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=191be49ae36be35276a2ba9ef20d7285468bfacd;p=packages%2Ftrusty%2Frabbitmq-server.git Tune 3.6.6 for mos7.0. 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 --- diff --git a/debian/changelog b/debian/changelog index 54f3998..611939a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +rabbitmq-server (3.6.6-1~u14.04+mos1) mos7.0-hotfix; urgency=medium + + * new upstream release + + -- Alexey Lebedeff Fri, 11 Nov 2016 15:06:56 +0000 + rabbitmq-server (3.6.5.907-1) unstable; urgency=low * New Upstream Release diff --git a/debian/control b/debian/control index 050051b..9d89f21 100644 --- a/debian/control +++ b/debian/control @@ -7,18 +7,18 @@ Uploaders: Michael Klishin , Jean-Sébastien Pédron 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 index 0000000..f18c459 --- /dev/null +++ b/debian/patches/policy_location.patch @@ -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 index 0000000..545c859 --- /dev/null +++ b/debian/patches/revert_private_attributes.patch @@ -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 index 0000000..f99b7b1 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +revert_private_attributes.patch +policy_location.patch diff --git a/debian/postrm.in b/debian/postrm.in old mode 100644 new mode 100755 index c2e9bbf..d7b77b2 --- a/debian/postrm.in +++ b/debian/postrm.in @@ -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 index 0000000..6eba844 --- /dev/null +++ b/debian/preinst @@ -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 diff --git a/debian/rabbitmq-server.default b/debian/rabbitmq-server.default index bde5e30..3eebe2f 100644 --- a/debian/rabbitmq-server.default +++ b/debian/rabbitmq-server.default @@ -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 diff --git a/debian/rules b/debian/rules index 48510ec..2eef4b2 100755 --- a/debian/rules +++ b/debian/rules @@ -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 index 0000000..eafb073 --- /dev/null +++ b/scripts/rabbitmq-fuel @@ -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 + + +Set ha-mode=all policy for RPC queues. Note that Ceilometer queues are not +affected by this flag. + +Set ha-mode=all policy for RPC queues + + + + + +Set ha-mode=all policy for Ceilometer queues. Note that RPC queues are not +affected by this flag. + +Set ha-mode=all policy for Ceilometer queues + + +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 index 0000000..8e69182 --- /dev/null +++ b/scripts/set_rabbitmq_policy.sh @@ -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