Skip to content

Commit 1d8261f

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add an option to enable version 1.0 of the AMQP messaging protocol"
2 parents 10b2b72 + 7e58c06 commit 1d8261f

2 files changed

Lines changed: 62 additions & 2 deletions

File tree

files/rpms/qpid

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
qpid-proton-c-devel # NOPRIME
2+
python-qpid-proton # NOPRIME
3+

lib/rpc_backend

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
# - ``functions`` file
88
# - ``RABBIT_{HOST|PASSWORD}`` must be defined when RabbitMQ is used
9+
# - ``RPC_MESSAGING_PROTOCOL`` option for configuring the messaging protocol
910

1011
# ``stack.sh`` calls the entry points in this order:
1112
#
@@ -90,21 +91,56 @@ function cleanup_rpc_backend {
9091
exit_distro_not_supported "zeromq installation"
9192
fi
9293
fi
94+
95+
# Remove the AMQP 1.0 messaging libraries
96+
if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
97+
if is_fedora; then
98+
uninstall_package qpid-proton-c-devel
99+
uninstall_package python-qpid-proton
100+
fi
101+
# TODO(kgiusti) ubuntu cleanup
102+
fi
93103
}
94104

95105
# install rpc backend
96106
function install_rpc_backend {
107+
# Regardless of the broker used, if AMQP 1.0 is configured load
108+
# the necessary messaging client libraries for oslo.messaging
109+
if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
110+
if is_fedora; then
111+
install_package qpid-proton-c-devel
112+
install_package python-qpid-proton
113+
elif is_ubuntu; then
114+
# TODO(kgiusti) The QPID AMQP 1.0 protocol libraries
115+
# are not yet in the ubuntu repos. Enable these installs
116+
# once they are present:
117+
#install_package libqpid-proton2-dev
118+
#install_package python-qpid-proton
119+
# Also add 'uninstall' directives in cleanup_rpc_backend()!
120+
exit_distro_not_supported "QPID AMQP 1.0 Proton libraries"
121+
else
122+
exit_distro_not_supported "QPID AMQP 1.0 Proton libraries"
123+
fi
124+
# Install pyngus client API
125+
# TODO(kgiusti) can remove once python qpid bindings are
126+
# available on all supported platforms _and_ pyngus is added
127+
# to the requirements.txt file in oslo.messaging
128+
pip_install pyngus
129+
fi
130+
97131
if is_service_enabled rabbit; then
98132
# Install rabbitmq-server
99133
install_package rabbitmq-server
100134
elif is_service_enabled qpid; then
135+
local qpid_conf_file=/etc/qpid/qpidd.conf
101136
if is_fedora; then
102137
install_package qpid-cpp-server
103138
if [[ $DISTRO =~ (rhel6) ]]; then
139+
qpid_conf_file=/etc/qpidd.conf
104140
# RHEL6 leaves "auth=yes" in /etc/qpidd.conf, it needs to
105141
# be no or you get GSS authentication errors as it
106142
# attempts to default to this.
107-
sudo sed -i.bak 's/^auth=yes$/auth=no/' /etc/qpidd.conf
143+
sudo sed -i.bak 's/^auth=yes$/auth=no/' $qpid_conf_file
108144
fi
109145
elif is_ubuntu; then
110146
install_package qpidd
@@ -113,6 +149,22 @@ function install_rpc_backend {
113149
else
114150
exit_distro_not_supported "qpid installation"
115151
fi
152+
# If AMQP 1.0 is specified, ensure that the version of the
153+
# broker can support AMQP 1.0 and configure the queue and
154+
# topic address patterns used by oslo.messaging.
155+
if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
156+
QPIDD=$(type -p qpidd)
157+
if ! $QPIDD --help | grep -q "queue-patterns"; then
158+
exit_distro_not_supported "qpidd with AMQP 1.0 support"
159+
fi
160+
if ! grep -q "queue-patterns=exclusive" $qpid_conf_file; then
161+
cat <<EOF | sudo tee --append $qpid_conf_file
162+
queue-patterns=exclusive
163+
queue-patterns=unicast
164+
topic-patterns=broadcast
165+
EOF
166+
fi
167+
fi
116168
elif is_service_enabled zeromq; then
117169
# NOTE(ewindisch): Redis is not strictly necessary
118170
# but there is a matchmaker driver that works
@@ -176,7 +228,12 @@ function iniset_rpc_backend {
176228
MATCHMAKER_REDIS_HOST=${MATCHMAKER_REDIS_HOST:-127.0.0.1}
177229
iniset $file matchmaker_redis host $MATCHMAKER_REDIS_HOST
178230
elif is_service_enabled qpid || [ -n "$QPID_HOST" ]; then
179-
iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
231+
# For Qpid use the 'amqp' oslo.messaging transport when AMQP 1.0 is used
232+
if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
233+
iniset $file $section rpc_backend "amqp"
234+
else
235+
iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
236+
fi
180237
iniset $file $section qpid_hostname ${QPID_HOST:-$SERVICE_HOST}
181238
if is_ubuntu; then
182239
QPID_PASSWORD=`sudo strings /etc/qpid/qpidd.sasldb | grep -B1 admin | head -1`

0 commit comments

Comments
 (0)