Browse code

Introduce CELLSV2_SETUP variable

Some environments, like grenade and ironic, need a way to revert to
the non fleet version of the conductor setup. This really comes down
to a global topology for CELLSV2_SETUP. The prefered is with a
superconductor, but allow a downgrade to singleconductor.

Depends-On: I5390ec14c41da0237c898852935aba3569e7acae

Change-Id: I10fb048ef2175909019461e585d117b4284448c6

Sean Dague authored on 2017/07/27 00:14:37
Showing 2 changed files
... ...
@@ -432,7 +432,16 @@ function create_nova_conf {
432 432
     # require them running on the host. The ensures that n-cpu doesn't
433 433
     # leak a need to use the db in a multinode scenario.
434 434
     if is_service_enabled n-api n-cond n-sched; then
435
-        iniset $NOVA_CONF database connection `database_connection_url nova_cell0`
435
+        # If we're in multi-tier cells mode, we want our control services pointing
436
+        # at cell0 instead of cell1 to ensure isolation. If not, we point everything
437
+        # at the main database like normal.
438
+        if [[ "$CELLSV2_SETUP" == "singleconductor" ]]; then
439
+            local db="nova_cell1"
440
+        else
441
+            local db="nova_cell0"
442
+        fi
443
+
444
+        iniset $NOVA_CONF database connection `database_connection_url $db`
436 445
         iniset $NOVA_CONF api_database connection `database_connection_url nova_api`
437 446
     fi
438 447
 
... ...
@@ -676,15 +685,15 @@ function init_nova {
676 676
         # and nova_cell0 databases.
677 677
         nova-manage cell_v2 map_cell0 --database_connection `database_connection_url nova_cell0`
678 678
 
679
-        # Migrate nova and nova_cell0 databases.
680
-        $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync
681
-
682 679
         # (Re)create nova databases
683 680
         for i in $(seq 1 $NOVA_NUM_CELLS); do
684 681
             recreate_database nova_cell${i}
685 682
             $NOVA_BIN_DIR/nova-manage --config-file $(conductor_conf $i) db sync
686 683
         done
687 684
 
685
+        # Migrate nova and nova_cell0 databases.
686
+        $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync
687
+
688 688
         if is_service_enabled n-cell; then
689 689
             recreate_database $NOVA_CELLS_DB
690 690
         fi
... ...
@@ -795,7 +804,6 @@ function start_nova_api {
795 795
 
796 796
 # start_nova_compute() - Start the compute process
797 797
 function start_nova_compute {
798
-    local nomulticellflag="$1"
799 798
     # Hack to set the path for rootwrap
800 799
     local old_path=$PATH
801 800
     export PATH=$NOVA_BIN_DIR:$PATH
... ...
@@ -803,17 +811,18 @@ function start_nova_compute {
803 803
     if is_service_enabled n-cell; then
804 804
         local compute_cell_conf=$NOVA_CELLS_CONF
805 805
         # NOTE(danms): Don't setup conductor fleet for cellsv1
806
-        nomulticellflag='nomulticell'
806
+        CELLSV2_SETUP="singleconductor"
807 807
     else
808 808
         local compute_cell_conf=$NOVA_CONF
809 809
     fi
810 810
 
811
-    if [ "$nomulticellflag" = 'nomulticell' ]; then
811
+    if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
812 812
         # NOTE(danms): Grenade doesn't setup multi-cell rabbit, so
813 813
         # skip these bits and use the normal config.
814 814
         NOVA_CPU_CONF=$compute_cell_conf
815 815
         echo "Skipping multi-cell conductor fleet setup"
816 816
     else
817
+        # "${CELLSV2_SETUP}" is "superconductor"
817 818
         cp $compute_cell_conf $NOVA_CPU_CONF
818 819
         # FIXME(danms): Should this be configurable?
819 820
         iniset $NOVA_CPU_CONF workarounds disable_group_policy_check_upcall True
... ...
@@ -77,6 +77,14 @@ ENABLE_HTTPD_MOD_WSGI_SERVICES=True
77 77
 # Set the default Nova APIs to enable
78 78
 NOVA_ENABLED_APIS=osapi_compute,metadata
79 79
 
80
+# CELLSV2_SETUP - how we should configure services with cells v2
81
+#
82
+# - superconductor - this is one conductor for the api services, and
83
+#   one per cell managing the compute services. This is prefered
84
+# - singleconductor - this is one conductor for the whole deployment,
85
+#   this is not recommended, and will be removed in the future.
86
+CELLSV2_SETUP=${CELLSV2_SETUP:-"superconductor"}
87
+
80 88
 # Set the root URL for Horizon
81 89
 HORIZON_APACHE_ROOT="/dashboard"
82 90