Browse Source

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
Thomas Herve 2 years ago
parent
commit
e8dfd2a928
2 changed files with 50 additions and 22 deletions
  1. 47
    20
      devstack/plugin.sh
  2. 3
    2
      devstack/settings

+ 47
- 20
devstack/plugin.sh View File

@@ -24,8 +24,9 @@
24 24
 # Environment Configuration
25 25
 #
26 26
 # AMQP1_SERVICE - identifies the messaging backend to use.  Should be
27
-#    one of 'qpid' for broker backend or 'qpid-dual' for hybrid router-broker.
28
-#    @TODO(kgiusti) add qpid-dispatch, rabbitmq, etc
27
+#    one of 'qpid' for broker backend, 'qpid-dual' for hybrid router-broker, or
28
+#    'qpid-hybrid' for keeping Rabbit for notifcations.
29
+#    @TODO(kgiusti) add qpid-dispatch, etc
29 30
 # AMQP1_HOST - the host used to connect to the messaging service.
30 31
 #    Defaults to 127.0.0.1
31 32
 # AMQP1_{DEFAULT_PORT, NOTIFY_PORT} - the port used to connect to the messaging
@@ -212,7 +213,7 @@ listener {
212 213
     role: normal
213 214
 EOF
214 215
     if [ -z "$AMQP1_USERNAME" ]; then
215
-	#no user configured, so disable authentication
216
+        #no user configured, so disable authentication
216 217
         cat <<EOF | sudo tee --append $qdr_conf_file
217 218
     authenticatePeer: no
218 219
 }
@@ -321,8 +322,10 @@ function _install_amqp1_backend {
321 322
         # expects epel is already added to the yum repos
322 323
         install_package cyrus-sasl-lib
323 324
         install_package cyrus-sasl-plain
324
-        install_package qpid-cpp-server
325
-        if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
325
+        if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
326
+            install_package qpid-cpp-server
327
+        fi
328
+        if [ "$AMQP1_SERVICE" != "qpid" ]; then
326 329
             install_package qpid-dispatch-router
327 330
         fi
328 331
     elif is_ubuntu; then
@@ -332,8 +335,10 @@ function _install_amqp1_backend {
332 335
         #sudo apt-get update
333 336
         REPOS_UPDATED=False
334 337
         update_package_repo
335
-        install_package qpidd
336
-        if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
338
+        if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
339
+            install_package qpidd
340
+        fi
341
+        if [ "$AMQP1_SERVICE" != "qpid" ]; then
337 342
             install_package qdrouterd
338 343
         fi
339 344
     else
@@ -341,8 +346,10 @@ function _install_amqp1_backend {
341 346
     fi
342 347
 
343 348
     _install_pyngus
344
-    _configure_qpid
345
-    if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
349
+    if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
350
+        _configure_qpid
351
+    fi
352
+    if [ "$AMQP1_SERVICE" != "qpid" ]; then
346 353
         _configure_qdr
347 354
     fi
348 355
 }
@@ -351,8 +358,10 @@ function _install_amqp1_backend {
351 358
 function _start_amqp1_backend {
352 359
     echo_summary "Starting amqp1 backends"
353 360
     # restart, since qpid* may already be running
354
-    restart_service qpidd
355
-    if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
361
+    if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
362
+        restart_service qpidd
363
+    fi
364
+    if [ "$AMQP1_SERVICE" != "qpid" ]; then
356 365
         restart_service qdrouterd
357 366
     fi
358 367
 }
@@ -360,18 +369,22 @@ function _start_amqp1_backend {
360 369
 
361 370
 function _cleanup_amqp1_backend {
362 371
     if is_fedora; then
363
-        uninstall_package qpid-cpp-server
364
-        if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
372
+        if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
373
+            uninstall_package qpid-cpp-server
374
+        fi
375
+        if [ "$AMQP1_SERVICE" != "qpid" ]; then
365 376
             uninstall_package qpid-dispatch-router
366 377
         fi
367
-	# TODO(kgiusti) can we pull these, or will that break other
368
-	# packages that depend on them?
378
+        # TODO(kgiusti) can we pull these, or will that break other
379
+        # packages that depend on them?
369 380
 
370 381
         # install_package cyrus_sasl_lib
371 382
         # install_package cyrus_sasl_plain
372 383
     elif is_ubuntu; then
373
-        uninstall_package qpidd
374
-        if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
384
+        if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
385
+            uninstall_package qpidd
386
+        fi
387
+        if [ "$AMQP1_SERVICE" != "qpid" ]; then
375 388
             uninstall_package qdrouterd
376 389
         fi
377 390
         # install_package sasl2-bin
@@ -392,6 +405,9 @@ function _iniset_amqp1_backend {
392 405
     if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
393 406
         iniset $file $section transport_url $(get_transport_url)
394 407
         iniset $file oslo_messaging_notifications transport_url $(_get_amqp1_notify_transport_url)
408
+    elif [ "$AMQP1_SERVICE" == "qpid-hybrid" ]; then
409
+        iniset $file $section transport_url $(get_transport_url)
410
+        iniset $file oslo_messaging_notifications transport_url $(_get_rabbit_transport_url)
395 411
     else
396 412
         iniset $file $section transport_url $(get_transport_url)
397 413
     fi
@@ -400,10 +416,15 @@ function _iniset_amqp1_backend {
400 416
 
401 417
 if is_service_enabled amqp1; then
402 418
     # @TODO (ansmith) check is for qdr or qpid for now
403
-    if [[ "$AMQP1_SERVICE" != "qpid" && "$AMQP1_SERVICE" != "qpid-dual" ]]; then
404
-        die $LINENO "AMQP 1.0 requires qpid or qpid-dual - $AMQP1_SERVICE not supported"
419
+    if [[ "$AMQP1_SERVICE" != "qpid" && "$AMQP1_SERVICE" != "qpid-dual" && "$AMQP1_SERVICE" != "qpid-hybrid" ]]; then
420
+        die $LINENO "AMQP 1.0 requires qpid, qpid-dual or qpid-hybrid - $AMQP1_SERVICE not supported"
405 421
     fi
406 422
 
423
+    # Save rabbit get_transport_url for notifications if necessary
424
+    get_transport_url_definition=$(declare -f get_transport_url)
425
+    eval "_get_rabbit_transport_url() ${get_transport_url_definition#*\()}"
426
+    export -f _get_rabbit_transport_url
427
+
407 428
     # Note: this is the only tricky part about out of tree rpc plugins,
408 429
     # you must overwrite the iniset_rpc_backend function so that when
409 430
     # that's passed around the correct settings files are made.
@@ -421,7 +442,13 @@ fi
421 442
 # check for amqp1 service
422 443
 if is_service_enabled amqp1; then
423 444
 
424
-    AMQP1_DEFAULT_PORT=${AMQP1_DEFAULT_PORT:=5672}
445
+    if [ "$AMQP1_SERVICE" != "qpid-hybrid" ]; then
446
+        available_port=5672
447
+    else
448
+        available_port=15672
449
+    fi
450
+
451
+    AMQP1_DEFAULT_PORT=${AMQP1_DEFAULT_PORT:=$available_port}
425 452
     AMQP1_NOTIFY_PORT=${AMQP1_NOTIFY_PORT:=5671}
426 453
 
427 454
     if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then

+ 3
- 2
devstack/settings View File

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

Loading…
Cancel
Save