Browse code

Revert "Fleetify nova conductor for N cells"

This reverts commit f63aa021cf996b500b6a570c0114c490bb57461a.

Change-Id: I541abe7311e5721d79e300fcb2a0b8ffdcd3c015
Related-Bug: #1700364

Matt Riedemann authored on 2017/06/26 16:53:08
Showing 2 changed files
... ...
@@ -53,18 +53,10 @@ NOVA_AUTH_CACHE_DIR=${NOVA_AUTH_CACHE_DIR:-/var/cache/nova}
53 53
 NOVA_CONF_DIR=/etc/nova
54 54
 NOVA_CONF=$NOVA_CONF_DIR/nova.conf
55 55
 NOVA_CELLS_CONF=$NOVA_CONF_DIR/nova-cells.conf
56
-NOVA_CPU_CONF=$NOVA_CONF_DIR/nova-cpu.conf
57 56
 NOVA_FAKE_CONF=$NOVA_CONF_DIR/nova-fake.conf
58 57
 NOVA_CELLS_DB=${NOVA_CELLS_DB:-nova_cell}
59 58
 NOVA_API_DB=${NOVA_API_DB:-nova_api}
60 59
 
61
-# The total number of cells we expect. Must be greater than one and doesn't
62
-# count cell0.
63
-NOVA_NUM_CELLS=${NOVA_NUM_CELLS:-1}
64
-# Our cell index, so we know what rabbit vhost to connect to.
65
-# This should be in the range of 1-$NOVA_NUM_CELLS
66
-NOVA_CPU_CELL=${NOVA_CPU_CELL:-1}
67
-
68 60
 NOVA_API_PASTE_INI=${NOVA_API_PASTE_INI:-$NOVA_CONF_DIR/api-paste.ini}
69 61
 
70 62
 if is_suse; then
... ...
@@ -487,7 +479,7 @@ function create_nova_conf {
487 487
     # require them running on the host. The ensures that n-cpu doesn't
488 488
     # leak a need to use the db in a multinode scenario.
489 489
     if is_service_enabled n-api n-cond n-sched; then
490
-        iniset $NOVA_CONF database connection `database_connection_url nova_cell0`
490
+        iniset $NOVA_CONF database connection `database_connection_url nova`
491 491
         iniset $NOVA_CONF api_database connection `database_connection_url nova_api`
492 492
     fi
493 493
 
... ...
@@ -622,20 +614,6 @@ function create_nova_conf {
622 622
     if [ "$NOVA_USE_SERVICE_TOKEN" == "True" ]; then
623 623
         init_nova_service_user_conf
624 624
     fi
625
-
626
-    if is_service_enabled n-cond; then
627
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
628
-            local conf
629
-            local vhost
630
-            conf=$(conductor_conf $i)
631
-            vhost="nova_cell${i}"
632
-            iniset $conf database connection `database_connection_url nova_cell${i}`
633
-            iniset $conf conductor workers "$API_WORKERS"
634
-            iniset $conf DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
635
-            rpc_backend_add_vhost $vhost
636
-            iniset_rpc_backend nova $conf DEFAULT $vhost
637
-        done
638
-    fi
639 625
 }
640 626
 
641 627
 function init_nova_service_user_conf {
... ...
@@ -650,11 +628,6 @@ function init_nova_service_user_conf {
650 650
     iniset $NOVA_CONF service_user auth_strategy keystone
651 651
 }
652 652
 
653
-function conductor_conf {
654
-    local cell="$1"
655
-    echo "${NOVA_CONF_DIR}/nova_cell${cell}.conf"
656
-}
657
-
658 653
 function init_nova_cells {
659 654
     if is_service_enabled n-cell; then
660 655
         cp $NOVA_CONF $NOVA_CELLS_CONF
... ...
@@ -719,6 +692,8 @@ function init_nova {
719 719
         recreate_database $NOVA_API_DB
720 720
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync
721 721
 
722
+        # (Re)create nova databases
723
+        recreate_database nova
722 724
         recreate_database nova_cell0
723 725
 
724 726
         # map_cell0 will create the cell mapping record in the nova_api DB so
... ...
@@ -730,12 +705,6 @@ function init_nova {
730 730
         # Migrate nova and nova_cell0 databases.
731 731
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync
732 732
 
733
-        # (Re)create nova databases
734
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
735
-            recreate_database nova_cell${i}
736
-            $NOVA_BIN_DIR/nova-manage --config-file $(conductor_conf $i) db sync
737
-        done
738
-
739 733
         if is_service_enabled n-cell; then
740 734
             recreate_database $NOVA_CELLS_DB
741 735
         fi
... ...
@@ -744,13 +713,9 @@ function init_nova {
744 744
         # Needed for flavor conversion
745 745
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations
746 746
 
747
-        # FIXME(danms): Should this be configurable?
748
-        iniset $NOVA_CONF workarounds disable_group_policy_check_upcall True
749
-
750 747
         # create the cell1 cell for the main nova db where the hosts live
751
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
752
-            nova-manage --config-file $NOVA_CONF --config-file $(conductor_conf $i) cell_v2 create_cell --name "cell$i"
753
-        done
748
+        nova-manage cell_v2 create_cell --transport-url $(get_transport_url) \
749
+            --name 'cell1'
754 750
     fi
755 751
 
756 752
     create_nova_cache_dir
... ...
@@ -858,38 +823,25 @@ function start_nova_api {
858 858
 
859 859
 # start_nova_compute() - Start the compute process
860 860
 function start_nova_compute {
861
-    local nomulticellflag="$1"
862 861
     # Hack to set the path for rootwrap
863 862
     local old_path=$PATH
864 863
     export PATH=$NOVA_BIN_DIR:$PATH
865 864
 
866 865
     if is_service_enabled n-cell; then
867 866
         local compute_cell_conf=$NOVA_CELLS_CONF
868
-        # NOTE(danms): Don't setup conductor fleet for cellsv1
869
-        nomulticellflag='nomulticell'
870 867
     else
871 868
         local compute_cell_conf=$NOVA_CONF
872 869
     fi
873 870
 
874
-    if [ "$nomulticellflag" = 'nomulticell' ]; then
875
-        # NOTE(danms): Grenade doesn't setup multi-cell rabbit, so
876
-        # skip these bits and use the normal config.
877
-        NOVA_CPU_CONF=$compute_cell_conf
878
-        echo "Skipping multi-cell conductor fleet setup"
879
-    else
880
-        cp $compute_cell_conf $NOVA_CPU_CONF
881
-        iniset_rpc_backend nova $NOVA_CPU_CONF DEFAULT "nova_cell${NOVA_CPU_CELL}"
882
-    fi
883
-
884 871
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
885 872
         # The group **$LIBVIRT_GROUP** is added to the current user in this script.
886 873
         # ``sg`` is used in run_process to execute nova-compute as a member of the
887 874
         # **$LIBVIRT_GROUP** group.
888
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF" $LIBVIRT_GROUP
875
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf" $LIBVIRT_GROUP
889 876
     elif [[ "$VIRT_DRIVER" = 'lxd' ]]; then
890
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF" $LXD_GROUP
877
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf" $LXD_GROUP
891 878
     elif [[ "$VIRT_DRIVER" = 'docker' || "$VIRT_DRIVER" = 'zun' ]]; then
892
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF" $DOCKER_GROUP
879
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf" $DOCKER_GROUP
893 880
     elif [[ "$VIRT_DRIVER" = 'fake' ]]; then
894 881
         local i
895 882
         for i in `seq 1 $NUMBER_FAKE_NOVA_COMPUTE`; do
... ...
@@ -898,13 +850,13 @@ function start_nova_compute {
898 898
             # gets its own configuration and own log file.
899 899
             local fake_conf="${NOVA_FAKE_CONF}-${i}"
900 900
             iniset $fake_conf DEFAULT nhost "${HOSTNAME}${i}"
901
-            run_process "n-cpu-${i}" "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF --config-file $fake_conf"
901
+            run_process "n-cpu-${i}" "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf --config-file $fake_conf"
902 902
         done
903 903
     else
904 904
         if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
905 905
             start_nova_hypervisor
906 906
         fi
907
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF"
907
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf"
908 908
     fi
909 909
 
910 910
     export PATH=$old_path
... ...
@@ -924,6 +876,7 @@ function start_nova_rest {
924 924
     fi
925 925
 
926 926
     # ``run_process`` checks ``is_service_enabled``, it is not needed here
927
+    run_process n-cond "$NOVA_BIN_DIR/nova-conductor --config-file $compute_cell_conf"
927 928
     run_process n-cell-region "$NOVA_BIN_DIR/nova-cells --config-file $api_cell_conf"
928 929
     run_process n-cell-child "$NOVA_BIN_DIR/nova-cells --config-file $compute_cell_conf"
929 930
 
... ...
@@ -946,38 +899,8 @@ function start_nova_rest {
946 946
     export PATH=$old_path
947 947
 }
948 948
 
949
-function enable_nova_fleet {
950
-    if is_service_enabled n-cond; then
951
-        enable_service n-super-cond
952
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
953
-            enable_service n-cond-cell${i}
954
-        done
955
-    fi
956
-}
957
-
958
-function start_nova_conductor {
959
-    if is_service_enabled n-cell; then
960
-        echo "Starting nova-conductor in a cellsv1-compatible way"
961
-        run_process n-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF"
962
-        return
963
-    fi
964
-
965
-    enable_nova_fleet
966
-    if is_service_enabled n-super-cond; then
967
-        run_process n-super-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CONF"
968
-    fi
969
-    for i in $(seq 1 $NOVA_NUM_CELLS); do
970
-        if is_service_enabled n-cond-cell${i}; then
971
-            local conf
972
-            conf=$(conductor_conf $i)
973
-            run_process n-cond-cell${i} "$NOVA_BIN_DIR/nova-conductor --config-file $conf"
974
-        fi
975
-    done
976
-}
977
-
978 949
 function start_nova {
979 950
     start_nova_rest
980
-    start_nova_conductor
981 951
     start_nova_compute
982 952
 }
983 953
 
... ...
@@ -1006,24 +929,14 @@ function stop_nova_rest {
1006 1006
     # Kill the nova screen windows
1007 1007
     # Some services are listed here twice since more than one instance
1008 1008
     # of a service may be running in certain configs.
1009
-    for serv in n-api n-net n-sch n-novnc n-xvnc n-cauth n-spice n-cell n-cell n-api-meta n-sproxy; do
1009
+    for serv in n-api n-net n-sch n-novnc n-xvnc n-cauth n-spice n-cond n-cell n-cell n-api-meta n-sproxy; do
1010 1010
         stop_process $serv
1011 1011
     done
1012 1012
 }
1013 1013
 
1014
-function stop_nova_conductor {
1015
-    enable_nova_fleet
1016
-    for srv in n-super-cond $(seq -f n-cond-cell%0.f 1 $NOVA_NUM_CELLS); do
1017
-        if is_service_enabled $srv; then
1018
-            stop_process $srv
1019
-        fi
1020
-    done
1021
-}
1022
-
1023 1014
 # stop_nova() - Stop running processes (non-screen)
1024 1015
 function stop_nova {
1025 1016
     stop_nova_rest
1026
-    stop_nova_conductor
1027 1017
     stop_nova_compute
1028 1018
 }
1029 1019
 
... ...
@@ -1268,9 +1268,7 @@ fi
1268 1268
 # Unable to use LUKS passphrase that is exactly 16 bytes long
1269 1269
 # https://bugzilla.redhat.com/show_bug.cgi?id=1447297
1270 1270
 if is_service_enabled nova; then
1271
-    key=$(generate_hex_string 36)
1272
-    iniset $NOVA_CONF key_manager fixed_key "$key"
1273
-    iniset $NOVA_CPU_CONF key_manager fixed_key "$key"
1271
+    iniset $NOVA_CONF key_manager fixed_key $(generate_hex_string 36)
1274 1272
 fi
1275 1273
 
1276 1274
 # Launch the nova-api and wait for it to answer before continuing