[Neutron] Do not execute RPC workers if "rpc_workers=0"

When the Neutron WSGI module is used, an independent service called
"neutron-rpc-server" is configured and executed. However it will fail
if the number of RPC workers is configured to zero. In that case,
the configuration and execution of this service should be skipped.

If the service is explicitly disabled in the devstack configuration,
it won't be executed neither.

Closes-Bug: #2073572
Change-Id: Idd023a2a8f588152221f20a13ae24fbb7d1618a4
This commit is contained in:
Rodolfo Alonso Hernandez 2024-07-19 08:09:25 +00:00
parent 6df5371918
commit aaaa03718b

View File

@ -142,6 +142,7 @@ Q_META_DATA_IP=${Q_META_DATA_IP:-$(ipv6_unquote $SERVICE_HOST)}
Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
Q_NOTIFY_NOVA_PORT_STATUS_CHANGES=${Q_NOTIFY_NOVA_PORT_STATUS_CHANGES:-True}
Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
_Q_RUN_RPC_SERVER=True
VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
@ -464,6 +465,15 @@ function configure_neutron {
# clouds, therefore running without a dedicated RPC worker
# for state reports is more than adequate.
iniset $NEUTRON_CONF DEFAULT rpc_state_report_workers 0
# The default value of "rpc_workers" is None (not defined). If
# "rpc_workers" is explicitly set to 0, the RPC workers process should not
# be executed. NOTE: this service is only executed when WSGI is enabled
# (NEUTRON_DEPLOY_MOD_WSGI=True) for the Neutron server.
local rpc_workers
rpc_workers=$(iniget_multiline /etc/neutron/neutron.conf DEFAULT rpc_workers)
if ! is_service_enabled neutron-rpc-server || [ "$rpc_workers" -eq "0" ]; then
_Q_RUN_RPC_SERVER=False
fi
if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
write_uwsgi_config "$NEUTRON_UWSGI_CONF" "$NEUTRON_BIN_DIR/neutron-api" "/networking"
@ -651,10 +661,14 @@ function start_neutron_service_and_check {
enable_service neutron-api
run_process neutron-api "$(which uwsgi) --procname-prefix neutron-api --ini $NEUTRON_UWSGI_CONF"
neutron_url=$Q_PROTOCOL://$Q_HOST/
enable_service neutron-rpc-server
if [[ "$_Q_RUN_RPC_SERVER" = True ]]; then
enable_service neutron-rpc-server
fi
enable_service neutron-periodic-workers
_enable_ovn_maintenance
run_process neutron-rpc-server "$NEUTRON_BIN_DIR/neutron-rpc-server $cfg_file_options"
if [[ "$_Q_RUN_RPC_SERVER" = True ]]; then
run_process neutron-rpc-server "$NEUTRON_BIN_DIR/neutron-rpc-server $cfg_file_options"
fi
run_process neutron-periodic-workers "$NEUTRON_BIN_DIR/neutron-periodic-workers $cfg_file_options"
_run_ovn_maintenance
else