Browse code

Fix last place where we need singleconductor

The actual logic of launching a singleconductor didn't get all the way
to the launch of the conductor itself, so we were still launching 2
conductors in the Ironic case. This attempts to fix that.

Change-Id: I7ddb123dbdf3e1ec9a991e474a9990d2ccbc30d3

Sean Dague authored on 2017/07/27 20:09:48
Showing 1 changed files
... ...
@@ -51,6 +51,7 @@ NOVA_AUTH_CACHE_DIR=${NOVA_AUTH_CACHE_DIR:-/var/cache/nova}
51 51
 NOVA_CONF_DIR=/etc/nova
52 52
 NOVA_CONF=$NOVA_CONF_DIR/nova.conf
53 53
 NOVA_CELLS_CONF=$NOVA_CONF_DIR/nova-cells.conf
54
+NOVA_COND_CONF=$NOVA_CONF_DIR/nova.conf
54 55
 NOVA_CPU_CONF=$NOVA_CONF_DIR/nova-cpu.conf
55 56
 NOVA_FAKE_CONF=$NOVA_CONF_DIR/nova-fake.conf
56 57
 NOVA_CELLS_DB=${NOVA_CELLS_DB:-nova_cell}
... ...
@@ -588,8 +589,13 @@ function create_nova_conf {
588 588
             iniset $conf database connection `database_connection_url nova_cell${i}`
589 589
             iniset $conf conductor workers "$API_WORKERS"
590 590
             iniset $conf DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
591
-            rpc_backend_add_vhost $vhost
592
-            iniset_rpc_backend nova $conf DEFAULT $vhost
591
+            # if we have a singleconductor, we don't have per host message queues.
592
+            if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
593
+                iniset_rpc_backend nova $conf DEFAULT
594
+            else
595
+                rpc_backend_add_vhost $vhost
596
+                iniset_rpc_backend nova $conf DEFAULT $vhost
597
+            fi
593 598
         done
594 599
     fi
595 600
 }
... ...
@@ -632,6 +638,9 @@ function init_nova_cells {
632 632
             iniset $NOVA_CELLS_CONF DEFAULT enabled_apis metadata
633 633
         fi
634 634
 
635
+        # Cells v1 conductor should be the nova-cells.conf
636
+        NOVA_COND_CONF=$NOVA_CELLS_CONF
637
+
635 638
         time_start "dbsync"
636 639
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync
637 640
         time_stop "dbsync"
... ...
@@ -802,6 +811,16 @@ function start_nova_api {
802 802
     export PATH=$old_path
803 803
 }
804 804
 
805
+# Detect and setup conditions under which singleconductor setup is
806
+# needed. Notably cellsv1.
807
+function _set_singleconductor {
808
+    # NOTE(danms): Don't setup conductor fleet for cellsv1
809
+    if is_service_enabled n-cell; then
810
+        CELLSV2_SETUP="singleconductor"
811
+    fi
812
+}
813
+
814
+
805 815
 # start_nova_compute() - Start the compute process
806 816
 function start_nova_compute {
807 817
     # Hack to set the path for rootwrap
... ...
@@ -810,8 +829,6 @@ function start_nova_compute {
810 810
 
811 811
     if is_service_enabled n-cell; then
812 812
         local compute_cell_conf=$NOVA_CELLS_CONF
813
-        # NOTE(danms): Don't setup conductor fleet for cellsv1
814
-        CELLSV2_SETUP="singleconductor"
815 813
     else
816 814
         local compute_cell_conf=$NOVA_CONF
817 815
     fi
... ...
@@ -908,15 +925,15 @@ function enable_nova_fleet {
908 908
 }
909 909
 
910 910
 function start_nova_conductor {
911
-    if is_service_enabled n-cell; then
911
+    if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
912 912
         echo "Starting nova-conductor in a cellsv1-compatible way"
913
-        run_process n-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF"
913
+        run_process n-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_COND_CONF"
914 914
         return
915 915
     fi
916 916
 
917 917
     enable_nova_fleet
918 918
     if is_service_enabled n-super-cond; then
919
-        run_process n-super-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CONF"
919
+        run_process n-super-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_COND_CONF"
920 920
     fi
921 921
     for i in $(seq 1 $NOVA_NUM_CELLS); do
922 922
         if is_service_enabled n-cond-cell${i}; then
... ...
@@ -928,9 +945,16 @@ function start_nova_conductor {
928 928
 }
929 929
 
930 930
 function start_nova {
931
+    # this catches the cells v1 case early
932
+    _set_singleconductor
931 933
     start_nova_rest
932 934
     start_nova_conductor
933 935
     start_nova_compute
936
+    if is_service_enabled n-api; then
937
+        # dump the cell mapping to ensure life is good
938
+        echo "Dumping cells_v2 mapping"
939
+        nova-manage cell_v2 list_cells --verbose
940
+    fi
934 941
 }
935 942
 
936 943
 function stop_nova_compute {