Browse code

Use transport_url instead of driver-specif options

Future oslo.messaging is going to deprecate usage of driver-specific
options for hosts/port/user/password options.

This change uses transport_url that exists since a while now and
works with all drivers (even devstack handles only the rabbit one).

Change-Id: I3006b96ff93a3468249177c31c359c2f9ddc5db6

Mehdi Abaakouk authored on 2016/05/18 19:10:08
Showing 2 changed files
... ...
@@ -639,7 +639,7 @@ function init_nova_cells {
639 639
     if is_service_enabled n-cell; then
640 640
         cp $NOVA_CONF $NOVA_CELLS_CONF
641 641
         iniset $NOVA_CELLS_CONF database connection `database_connection_url $NOVA_CELLS_DB`
642
-        iniset $NOVA_CELLS_CONF oslo_messaging_rabbit rabbit_virtual_host child_cell
642
+        iniset_rpc_backend nova $NOVA_CELLS_CONF DEFAULT child_cell
643 643
         iniset $NOVA_CELLS_CONF DEFAULT dhcpbridge_flagfile $NOVA_CELLS_CONF
644 644
         iniset $NOVA_CELLS_CONF cells enable True
645 645
         iniset $NOVA_CELLS_CONF cells cell_type compute
... ...
@@ -104,8 +104,9 @@ function restart_rpc_backend {
104 104
 
105 105
 # builds transport url string
106 106
 function get_transport_url {
107
+    local virtual_host=$1
107 108
     if is_service_enabled rabbit || { [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; }; then
108
-        echo "rabbit://$RABBIT_USERID:$RABBIT_PASSWORD@$RABBIT_HOST:5672/"
109
+        echo "rabbit://$RABBIT_USERID:$RABBIT_PASSWORD@$RABBIT_HOST:5672/$virtual_host"
109 110
     fi
110 111
 }
111 112
 
... ...
@@ -114,11 +115,9 @@ function iniset_rpc_backend {
114 114
     local package=$1
115 115
     local file=$2
116 116
     local section=${3:-DEFAULT}
117
+    local virtual_host=$4
117 118
     if is_service_enabled rabbit || { [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; }; then
118
-        iniset $file $section rpc_backend "rabbit"
119
-        iniset $file oslo_messaging_rabbit rabbit_hosts $RABBIT_HOST
120
-        iniset $file oslo_messaging_rabbit rabbit_password $RABBIT_PASSWORD
121
-        iniset $file oslo_messaging_rabbit rabbit_userid $RABBIT_USERID
119
+        iniset $file $section transport_url $(get_transport_url "$virtual_host")
122 120
         if [ -n "$RABBIT_HEARTBEAT_TIMEOUT_THRESHOLD" ]; then
123 121
             iniset $file oslo_messaging_rabbit heartbeat_timeout_threshold $RABBIT_HEARTBEAT_TIMEOUT_THRESHOLD
124 122
         fi