Browse code

Merge "Revert "Fleetify nova conductor for N cells""

Jenkins authored on 2017/06/27 00:49:03
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
... ...
@@ -721,6 +694,8 @@ function init_nova {
721 721
         recreate_database $NOVA_API_DB
722 722
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync
723 723
 
724
+        # (Re)create nova databases
725
+        recreate_database nova
724 726
         recreate_database nova_cell0
725 727
 
726 728
         # map_cell0 will create the cell mapping record in the nova_api DB so
... ...
@@ -732,12 +707,6 @@ function init_nova {
732 732
         # Migrate nova and nova_cell0 databases.
733 733
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db sync
734 734
 
735
-        # (Re)create nova databases
736
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
737
-            recreate_database nova_cell${i}
738
-            $NOVA_BIN_DIR/nova-manage --config-file $(conductor_conf $i) db sync
739
-        done
740
-
741 735
         if is_service_enabled n-cell; then
742 736
             recreate_database $NOVA_CELLS_DB
743 737
         fi
... ...
@@ -746,13 +715,9 @@ function init_nova {
746 746
         # Needed for flavor conversion
747 747
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF db online_data_migrations
748 748
 
749
-        # FIXME(danms): Should this be configurable?
750
-        iniset $NOVA_CONF workarounds disable_group_policy_check_upcall True
751
-
752 749
         # create the cell1 cell for the main nova db where the hosts live
753
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
754
-            nova-manage --config-file $NOVA_CONF --config-file $(conductor_conf $i) cell_v2 create_cell --name "cell$i"
755
-        done
750
+        nova-manage cell_v2 create_cell --transport-url $(get_transport_url) \
751
+            --name 'cell1'
756 752
     fi
757 753
 
758 754
     create_nova_cache_dir
... ...
@@ -860,38 +825,25 @@ function start_nova_api {
860 860
 
861 861
 # start_nova_compute() - Start the compute process
862 862
 function start_nova_compute {
863
-    local nomulticellflag="$1"
864 863
     # Hack to set the path for rootwrap
865 864
     local old_path=$PATH
866 865
     export PATH=$NOVA_BIN_DIR:$PATH
867 866
 
868 867
     if is_service_enabled n-cell; then
869 868
         local compute_cell_conf=$NOVA_CELLS_CONF
870
-        # NOTE(danms): Don't setup conductor fleet for cellsv1
871
-        nomulticellflag='nomulticell'
872 869
     else
873 870
         local compute_cell_conf=$NOVA_CONF
874 871
     fi
875 872
 
876
-    if [ "$nomulticellflag" = 'nomulticell' ]; then
877
-        # NOTE(danms): Grenade doesn't setup multi-cell rabbit, so
878
-        # skip these bits and use the normal config.
879
-        NOVA_CPU_CONF=$compute_cell_conf
880
-        echo "Skipping multi-cell conductor fleet setup"
881
-    else
882
-        cp $compute_cell_conf $NOVA_CPU_CONF
883
-        iniset_rpc_backend nova $NOVA_CPU_CONF DEFAULT "nova_cell${NOVA_CPU_CELL}"
884
-    fi
885
-
886 873
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
887 874
         # The group **$LIBVIRT_GROUP** is added to the current user in this script.
888 875
         # ``sg`` is used in run_process to execute nova-compute as a member of the
889 876
         # **$LIBVIRT_GROUP** group.
890
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF" $LIBVIRT_GROUP
877
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf" $LIBVIRT_GROUP
891 878
     elif [[ "$VIRT_DRIVER" = 'lxd' ]]; then
892
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF" $LXD_GROUP
879
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf" $LXD_GROUP
893 880
     elif [[ "$VIRT_DRIVER" = 'docker' || "$VIRT_DRIVER" = 'zun' ]]; then
894
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF" $DOCKER_GROUP
881
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf" $DOCKER_GROUP
895 882
     elif [[ "$VIRT_DRIVER" = 'fake' ]]; then
896 883
         local i
897 884
         for i in `seq 1 $NUMBER_FAKE_NOVA_COMPUTE`; do
... ...
@@ -900,13 +852,13 @@ function start_nova_compute {
900 900
             # gets its own configuration and own log file.
901 901
             local fake_conf="${NOVA_FAKE_CONF}-${i}"
902 902
             iniset $fake_conf DEFAULT nhost "${HOSTNAME}${i}"
903
-            run_process "n-cpu-${i}" "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF --config-file $fake_conf"
903
+            run_process "n-cpu-${i}" "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf --config-file $fake_conf"
904 904
         done
905 905
     else
906 906
         if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
907 907
             start_nova_hypervisor
908 908
         fi
909
-        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF"
909
+        run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf"
910 910
     fi
911 911
 
912 912
     export PATH=$old_path
... ...
@@ -926,6 +878,7 @@ function start_nova_rest {
926 926
     fi
927 927
 
928 928
     # ``run_process`` checks ``is_service_enabled``, it is not needed here
929
+    run_process n-cond "$NOVA_BIN_DIR/nova-conductor --config-file $compute_cell_conf"
929 930
     run_process n-cell-region "$NOVA_BIN_DIR/nova-cells --config-file $api_cell_conf"
930 931
     run_process n-cell-child "$NOVA_BIN_DIR/nova-cells --config-file $compute_cell_conf"
931 932
 
... ...
@@ -948,38 +901,8 @@ function start_nova_rest {
948 948
     export PATH=$old_path
949 949
 }
950 950
 
951
-function enable_nova_fleet {
952
-    if is_service_enabled n-cond; then
953
-        enable_service n-super-cond
954
-        for i in $(seq 1 $NOVA_NUM_CELLS); do
955
-            enable_service n-cond-cell${i}
956
-        done
957
-    fi
958
-}
959
-
960
-function start_nova_conductor {
961
-    if is_service_enabled n-cell; then
962
-        echo "Starting nova-conductor in a cellsv1-compatible way"
963
-        run_process n-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF"
964
-        return
965
-    fi
966
-
967
-    enable_nova_fleet
968
-    if is_service_enabled n-super-cond; then
969
-        run_process n-super-cond "$NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CONF"
970
-    fi
971
-    for i in $(seq 1 $NOVA_NUM_CELLS); do
972
-        if is_service_enabled n-cond-cell${i}; then
973
-            local conf
974
-            conf=$(conductor_conf $i)
975
-            run_process n-cond-cell${i} "$NOVA_BIN_DIR/nova-conductor --config-file $conf"
976
-        fi
977
-    done
978
-}
979
-
980 951
 function start_nova {
981 952
     start_nova_rest
982
-    start_nova_conductor
983 953
     start_nova_compute
984 954
 }
985 955
 
... ...
@@ -1008,24 +931,14 @@ function stop_nova_rest {
1008 1008
     # Kill the nova screen windows
1009 1009
     # Some services are listed here twice since more than one instance
1010 1010
     # of a service may be running in certain configs.
1011
-    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
1011
+    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
1012 1012
         stop_process $serv
1013 1013
     done
1014 1014
 }
1015 1015
 
1016
-function stop_nova_conductor {
1017
-    enable_nova_fleet
1018
-    for srv in n-super-cond $(seq -f n-cond-cell%0.f 1 $NOVA_NUM_CELLS); do
1019
-        if is_service_enabled $srv; then
1020
-            stop_process $srv
1021
-        fi
1022
-    done
1023
-}
1024
-
1025 1016
 # stop_nova() - Stop running processes (non-screen)
1026 1017
 function stop_nova {
1027 1018
     stop_nova_rest
1028
-    stop_nova_conductor
1029 1019
     stop_nova_compute
1030 1020
 }
1031 1021
 
... ...
@@ -1301,9 +1301,7 @@ fi
1301 1301
 # Unable to use LUKS passphrase that is exactly 16 bytes long
1302 1302
 # https://bugzilla.redhat.com/show_bug.cgi?id=1447297
1303 1303
 if is_service_enabled nova; then
1304
-    key=$(generate_hex_string 36)
1305
-    iniset $NOVA_CONF key_manager fixed_key "$key"
1306
-    iniset $NOVA_CPU_CONF key_manager fixed_key "$key"
1304
+    iniset $NOVA_CONF key_manager fixed_key $(generate_hex_string 36)
1307 1305
 fi
1308 1306
 
1309 1307
 # Launch the nova-api and wait for it to answer before continuing