Add a new mode for using rabbit for notifications

This adds a new "qpid-hybrid" AMQP1_SERVICE value which keeps RabbitMQ for
notifications, and use qpid for RPC.

Change-Id: Iaa94a5f777ee7f37e2b9fd4471a078cf750a0f06
This commit is contained in:
Thomas Herve 2017-02-23 14:57:57 -05:00
parent 264ed1c33e
commit e8dfd2a928
2 changed files with 50 additions and 22 deletions

View File

@ -24,8 +24,9 @@
# Environment Configuration # Environment Configuration
# #
# AMQP1_SERVICE - identifies the messaging backend to use. Should be # AMQP1_SERVICE - identifies the messaging backend to use. Should be
# one of 'qpid' for broker backend or 'qpid-dual' for hybrid router-broker. # one of 'qpid' for broker backend, 'qpid-dual' for hybrid router-broker, or
# @TODO(kgiusti) add qpid-dispatch, rabbitmq, etc # 'qpid-hybrid' for keeping Rabbit for notifcations.
# @TODO(kgiusti) add qpid-dispatch, etc
# AMQP1_HOST - the host used to connect to the messaging service. # AMQP1_HOST - the host used to connect to the messaging service.
# Defaults to 127.0.0.1 # Defaults to 127.0.0.1
# AMQP1_{DEFAULT_PORT, NOTIFY_PORT} - the port used to connect to the messaging # AMQP1_{DEFAULT_PORT, NOTIFY_PORT} - the port used to connect to the messaging
@ -212,7 +213,7 @@ listener {
role: normal role: normal
EOF EOF
if [ -z "$AMQP1_USERNAME" ]; then if [ -z "$AMQP1_USERNAME" ]; then
#no user configured, so disable authentication #no user configured, so disable authentication
cat <<EOF | sudo tee --append $qdr_conf_file cat <<EOF | sudo tee --append $qdr_conf_file
authenticatePeer: no authenticatePeer: no
} }
@ -321,8 +322,10 @@ function _install_amqp1_backend {
# expects epel is already added to the yum repos # expects epel is already added to the yum repos
install_package cyrus-sasl-lib install_package cyrus-sasl-lib
install_package cyrus-sasl-plain install_package cyrus-sasl-plain
install_package qpid-cpp-server if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then install_package qpid-cpp-server
fi
if [ "$AMQP1_SERVICE" != "qpid" ]; then
install_package qpid-dispatch-router install_package qpid-dispatch-router
fi fi
elif is_ubuntu; then elif is_ubuntu; then
@ -332,8 +335,10 @@ function _install_amqp1_backend {
#sudo apt-get update #sudo apt-get update
REPOS_UPDATED=False REPOS_UPDATED=False
update_package_repo update_package_repo
install_package qpidd if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then install_package qpidd
fi
if [ "$AMQP1_SERVICE" != "qpid" ]; then
install_package qdrouterd install_package qdrouterd
fi fi
else else
@ -341,8 +346,10 @@ function _install_amqp1_backend {
fi fi
_install_pyngus _install_pyngus
_configure_qpid if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then _configure_qpid
fi
if [ "$AMQP1_SERVICE" != "qpid" ]; then
_configure_qdr _configure_qdr
fi fi
} }
@ -351,8 +358,10 @@ function _install_amqp1_backend {
function _start_amqp1_backend { function _start_amqp1_backend {
echo_summary "Starting amqp1 backends" echo_summary "Starting amqp1 backends"
# restart, since qpid* may already be running # restart, since qpid* may already be running
restart_service qpidd if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then restart_service qpidd
fi
if [ "$AMQP1_SERVICE" != "qpid" ]; then
restart_service qdrouterd restart_service qdrouterd
fi fi
} }
@ -360,18 +369,22 @@ function _start_amqp1_backend {
function _cleanup_amqp1_backend { function _cleanup_amqp1_backend {
if is_fedora; then if is_fedora; then
uninstall_package qpid-cpp-server if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then uninstall_package qpid-cpp-server
fi
if [ "$AMQP1_SERVICE" != "qpid" ]; then
uninstall_package qpid-dispatch-router uninstall_package qpid-dispatch-router
fi fi
# TODO(kgiusti) can we pull these, or will that break other # TODO(kgiusti) can we pull these, or will that break other
# packages that depend on them? # packages that depend on them?
# install_package cyrus_sasl_lib # install_package cyrus_sasl_lib
# install_package cyrus_sasl_plain # install_package cyrus_sasl_plain
elif is_ubuntu; then elif is_ubuntu; then
uninstall_package qpidd if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then uninstall_package qpidd
fi
if [ "$AMQP1_SERVICE" != "qpid" ]; then
uninstall_package qdrouterd uninstall_package qdrouterd
fi fi
# install_package sasl2-bin # install_package sasl2-bin
@ -392,6 +405,9 @@ function _iniset_amqp1_backend {
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
iniset $file $section transport_url $(get_transport_url) iniset $file $section transport_url $(get_transport_url)
iniset $file oslo_messaging_notifications transport_url $(_get_amqp1_notify_transport_url) iniset $file oslo_messaging_notifications transport_url $(_get_amqp1_notify_transport_url)
elif [ "$AMQP1_SERVICE" == "qpid-hybrid" ]; then
iniset $file $section transport_url $(get_transport_url)
iniset $file oslo_messaging_notifications transport_url $(_get_rabbit_transport_url)
else else
iniset $file $section transport_url $(get_transport_url) iniset $file $section transport_url $(get_transport_url)
fi fi
@ -400,10 +416,15 @@ function _iniset_amqp1_backend {
if is_service_enabled amqp1; then if is_service_enabled amqp1; then
# @TODO (ansmith) check is for qdr or qpid for now # @TODO (ansmith) check is for qdr or qpid for now
if [[ "$AMQP1_SERVICE" != "qpid" && "$AMQP1_SERVICE" != "qpid-dual" ]]; then if [[ "$AMQP1_SERVICE" != "qpid" && "$AMQP1_SERVICE" != "qpid-dual" && "$AMQP1_SERVICE" != "qpid-hybrid" ]]; then
die $LINENO "AMQP 1.0 requires qpid or qpid-dual - $AMQP1_SERVICE not supported" die $LINENO "AMQP 1.0 requires qpid, qpid-dual or qpid-hybrid - $AMQP1_SERVICE not supported"
fi fi
# Save rabbit get_transport_url for notifications if necessary
get_transport_url_definition=$(declare -f get_transport_url)
eval "_get_rabbit_transport_url() ${get_transport_url_definition#*\()}"
export -f _get_rabbit_transport_url
# Note: this is the only tricky part about out of tree rpc plugins, # Note: this is the only tricky part about out of tree rpc plugins,
# you must overwrite the iniset_rpc_backend function so that when # you must overwrite the iniset_rpc_backend function so that when
# that's passed around the correct settings files are made. # that's passed around the correct settings files are made.
@ -421,7 +442,13 @@ fi
# check for amqp1 service # check for amqp1 service
if is_service_enabled amqp1; then if is_service_enabled amqp1; then
AMQP1_DEFAULT_PORT=${AMQP1_DEFAULT_PORT:=5672} if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
available_port=5672
else
available_port=15672
fi
AMQP1_DEFAULT_PORT=${AMQP1_DEFAULT_PORT:=$available_port}
AMQP1_NOTIFY_PORT=${AMQP1_NOTIFY_PORT:=5671} AMQP1_NOTIFY_PORT=${AMQP1_NOTIFY_PORT:=5671}
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then

View File

@ -1,6 +1,7 @@
enable_service amqp1 enable_service amqp1
disable_service rabbit
AMQP1_SERVICE=${AMQP1_SERVICE:-qpid} AMQP1_SERVICE=${AMQP1_SERVICE:-qpid}
AMQP1_HOST=${AMQP1_HOST:-$SERVICE_HOST} AMQP1_HOST=${AMQP1_HOST:-$SERVICE_HOST}
if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
disable_service rabbit
fi