Browse code

Merge "Run console proxies per cell instead of globally"

Zuul authored on 2018/05/05 01:16:10
Showing 2 changed files
... ...
@@ -952,11 +952,46 @@ function start_nova_rest {
952 952
         run_process n-api-meta "$NOVA_BIN_DIR/uwsgi --procname-prefix nova-api-meta --ini $NOVA_METADATA_UWSGI_CONF"
953 953
     fi
954 954
 
955
-    run_process n-novnc "$NOVA_BIN_DIR/nova-novncproxy --config-file $api_cell_conf --web $NOVNC_WEB_DIR"
956
-    run_process n-xvnc "$NOVA_BIN_DIR/nova-xvpvncproxy --config-file $api_cell_conf"
957
-    run_process n-spice "$NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $api_cell_conf --web $SPICE_WEB_DIR"
955
+    # nova-consoleauth always runs globally
958 956
     run_process n-cauth "$NOVA_BIN_DIR/nova-consoleauth --config-file $api_cell_conf"
959
-    run_process n-sproxy "$NOVA_BIN_DIR/nova-serialproxy --config-file $api_cell_conf"
957
+
958
+    export PATH=$old_path
959
+}
960
+
961
+function enable_nova_console_proxies {
962
+    for i in $(seq 1 $NOVA_NUM_CELLS); do
963
+        for srv in n-novnc n-xvnc n-spice n-sproxy; do
964
+            if is_service_enabled $srv; then
965
+                enable_service ${srv}-cell${i}
966
+            fi
967
+        done
968
+    done
969
+}
970
+
971
+function start_nova_console_proxies {
972
+    # Hack to set the path for rootwrap
973
+    local old_path=$PATH
974
+    # This is needed to find the nova conf
975
+    export PATH=$NOVA_BIN_DIR:$PATH
976
+
977
+    local api_cell_conf=$NOVA_CONF
978
+    # console proxies run globally for singleconductor, else they run per cell
979
+    if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
980
+        run_process n-novnc "$NOVA_BIN_DIR/nova-novncproxy --config-file $api_cell_conf --web $NOVNC_WEB_DIR"
981
+        run_process n-xvnc "$NOVA_BIN_DIR/nova-xvpvncproxy --config-file $api_cell_conf"
982
+        run_process n-spice "$NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $api_cell_conf --web $SPICE_WEB_DIR"
983
+        run_process n-sproxy "$NOVA_BIN_DIR/nova-serialproxy --config-file $api_cell_conf"
984
+    else
985
+        enable_nova_console_proxies
986
+        for i in $(seq 1 $NOVA_NUM_CELLS); do
987
+            local conf
988
+            conf=$(conductor_conf $i)
989
+            run_process n-novnc-cell${i} "$NOVA_BIN_DIR/nova-novncproxy --config-file $conf --web $NOVNC_WEB_DIR"
990
+            run_process n-xvnc-cell${i} "$NOVA_BIN_DIR/nova-xvpvncproxy --config-file $conf"
991
+            run_process n-spice-cell${i} "$NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $conf --web $SPICE_WEB_DIR"
992
+            run_process n-sproxy-cell${i} "$NOVA_BIN_DIR/nova-serialproxy --config-file $conf"
993
+        done
994
+    fi
960 995
 
961 996
     export PATH=$old_path
962 997
 }
... ...
@@ -1016,6 +1051,7 @@ function start_nova {
1016 1016
     # this catches the cells v1 case early
1017 1017
     _set_singleconductor
1018 1018
     start_nova_rest
1019
+    start_nova_console_proxies
1019 1020
     start_nova_conductor
1020 1021
     start_nova_compute
1021 1022
     if is_service_enabled n-api; then
... ...
@@ -1041,11 +1077,26 @@ function stop_nova_compute {
1041 1041
 
1042 1042
 function stop_nova_rest {
1043 1043
     # Kill the non-compute nova processes
1044
-    for serv in n-api n-api-meta n-net n-sch n-novnc n-xvnc n-cauth n-spice n-cell n-cell n-sproxy; do
1044
+    for serv in n-api n-api-meta n-net n-sch n-cauth n-cell n-cell; do
1045 1045
         stop_process $serv
1046 1046
     done
1047 1047
 }
1048 1048
 
1049
+function stop_nova_console_proxies {
1050
+    if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
1051
+        for srv in n-novnc n-xvnc n-spice n-sproxy; do
1052
+            stop_process $srv
1053
+        done
1054
+    else
1055
+        enable_nova_console_proxies
1056
+        for i in $(seq 1 $NOVA_NUM_CELLS); do
1057
+            for srv in n-novnc n-xvnc n-spice n-sproxy; do
1058
+                stop_process ${srv}-cell${i}
1059
+            done
1060
+        done
1061
+    fi
1062
+}
1063
+
1049 1064
 function stop_nova_conductor {
1050 1065
     if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
1051 1066
         stop_process n-cond
... ...
@@ -1063,6 +1114,7 @@ function stop_nova_conductor {
1063 1063
 # stop_nova() - Stop running processes
1064 1064
 function stop_nova {
1065 1065
     stop_nova_rest
1066
+    stop_nova_console_proxies
1066 1067
     stop_nova_conductor
1067 1068
     stop_nova_compute
1068 1069
 }
... ...
@@ -394,7 +394,14 @@ function configure_tempest {
394 394
         iniset $TEMPEST_CONFIG compute-feature-enabled volume_multiattach True
395 395
     fi
396 396
 
397
-    if is_service_enabled n-novnc; then
397
+    # TODO(melwitt): If we're running per-cell console proxies, the novnc tests
398
+    # won't work until the nova patch series lands that converts from the
399
+    # nova-consoleauth backend -> cell database backend. So disable them unless
400
+    # we're running Cells v1. Cells v1 will never support the cell database
401
+    # backend, so it will always run with a global nova-consoleauth.
402
+    # Once the patch that converts from the nova-consoleauth backend -> cell
403
+    # database backend lands, we can re-enable the novnc tests for Cells v2.
404
+    if is_service_enabled n-novnc && is_service_enabled n-cell; then
398 405
         iniset $TEMPEST_CONFIG compute-feature-enabled vnc_console True
399 406
     fi
400 407