Browse code

Merge "Add an option to enable version 1.0 of the AMQP messaging protocol"

Jenkins authored on 2014/09/16 17:22:48
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+qpid-proton-c-devel # NOPRIME
1
+python-qpid-proton # NOPRIME
2
+
... ...
@@ -6,6 +6,7 @@
6 6
 #
7 7
 # - ``functions`` file
8 8
 # - ``RABBIT_{HOST|PASSWORD}`` must be defined when RabbitMQ is used
9
+# - ``RPC_MESSAGING_PROTOCOL`` option for configuring the messaging protocol
9 10
 
10 11
 # ``stack.sh`` calls the entry points in this order:
11 12
 #
... ...
@@ -90,21 +91,56 @@ function cleanup_rpc_backend {
90 90
             exit_distro_not_supported "zeromq installation"
91 91
         fi
92 92
     fi
93
+
94
+    # Remove the AMQP 1.0 messaging libraries
95
+    if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
96
+        if is_fedora; then
97
+            uninstall_package qpid-proton-c-devel
98
+            uninstall_package python-qpid-proton
99
+        fi
100
+        # TODO(kgiusti) ubuntu cleanup
101
+    fi
93 102
 }
94 103
 
95 104
 # install rpc backend
96 105
 function install_rpc_backend {
106
+    # Regardless of the broker used, if AMQP 1.0 is configured load
107
+    # the necessary messaging client libraries for oslo.messaging
108
+    if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
109
+        if is_fedora; then
110
+            install_package qpid-proton-c-devel
111
+            install_package python-qpid-proton
112
+        elif is_ubuntu; then
113
+            # TODO(kgiusti) The QPID AMQP 1.0 protocol libraries
114
+            # are not yet in the ubuntu repos. Enable these installs
115
+            # once they are present:
116
+            #install_package libqpid-proton2-dev
117
+            #install_package python-qpid-proton
118
+            # Also add 'uninstall' directives in cleanup_rpc_backend()!
119
+            exit_distro_not_supported "QPID AMQP 1.0 Proton libraries"
120
+        else
121
+            exit_distro_not_supported "QPID AMQP 1.0 Proton libraries"
122
+        fi
123
+        # Install pyngus client API
124
+        # TODO(kgiusti) can remove once python qpid bindings are
125
+        # available on all supported platforms _and_ pyngus is added
126
+        # to the requirements.txt file in oslo.messaging
127
+        pip_install pyngus
128
+    fi
129
+
97 130
     if is_service_enabled rabbit; then
98 131
         # Install rabbitmq-server
99 132
         install_package rabbitmq-server
100 133
     elif is_service_enabled qpid; then
134
+        local qpid_conf_file=/etc/qpid/qpidd.conf
101 135
         if is_fedora; then
102 136
             install_package qpid-cpp-server
103 137
             if [[ $DISTRO =~ (rhel6) ]]; then
138
+                qpid_conf_file=/etc/qpidd.conf
104 139
                 # RHEL6 leaves "auth=yes" in /etc/qpidd.conf, it needs to
105 140
                 # be no or you get GSS authentication errors as it
106 141
                 # attempts to default to this.
107
-                sudo sed -i.bak 's/^auth=yes$/auth=no/' /etc/qpidd.conf
142
+                sudo sed -i.bak 's/^auth=yes$/auth=no/' $qpid_conf_file
108 143
             fi
109 144
         elif is_ubuntu; then
110 145
             install_package qpidd
... ...
@@ -113,6 +149,22 @@ function install_rpc_backend {
113 113
         else
114 114
             exit_distro_not_supported "qpid installation"
115 115
         fi
116
+        # If AMQP 1.0 is specified, ensure that the version of the
117
+        # broker can support AMQP 1.0 and configure the queue and
118
+        # topic address patterns used by oslo.messaging.
119
+        if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
120
+            QPIDD=$(type -p qpidd)
121
+            if ! $QPIDD --help | grep -q "queue-patterns"; then
122
+                exit_distro_not_supported "qpidd with AMQP 1.0 support"
123
+            fi
124
+            if ! grep -q "queue-patterns=exclusive" $qpid_conf_file; then
125
+                cat <<EOF | sudo tee --append $qpid_conf_file
126
+queue-patterns=exclusive
127
+queue-patterns=unicast
128
+topic-patterns=broadcast
129
+EOF
130
+            fi
131
+        fi
116 132
     elif is_service_enabled zeromq; then
117 133
         # NOTE(ewindisch): Redis is not strictly necessary
118 134
         # but there is a matchmaker driver that works
... ...
@@ -176,7 +228,12 @@ function iniset_rpc_backend {
176 176
         MATCHMAKER_REDIS_HOST=${MATCHMAKER_REDIS_HOST:-127.0.0.1}
177 177
         iniset $file matchmaker_redis host $MATCHMAKER_REDIS_HOST
178 178
     elif is_service_enabled qpid || [ -n "$QPID_HOST" ]; then
179
-        iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
179
+        # For Qpid use the 'amqp' oslo.messaging transport when AMQP 1.0 is used
180
+        if [ "$RPC_MESSAGING_PROTOCOL" == "AMQP1" ]; then
181
+            iniset $file $section rpc_backend "amqp"
182
+        else
183
+            iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
184
+        fi
180 185
         iniset $file $section qpid_hostname ${QPID_HOST:-$SERVICE_HOST}
181 186
         if is_ubuntu; then
182 187
             QPID_PASSWORD=`sudo strings /etc/qpid/qpidd.sasldb | grep -B1 admin | head -1`