Skip to content

Commit aaaa037

Browse files
committed
[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
1 parent 6df5371 commit aaaa037

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

lib/neutron

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ Q_META_DATA_IP=${Q_META_DATA_IP:-$(ipv6_unquote $SERVICE_HOST)}
142142
Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
143143
Q_NOTIFY_NOVA_PORT_STATUS_CHANGES=${Q_NOTIFY_NOVA_PORT_STATUS_CHANGES:-True}
144144
Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
145+
_Q_RUN_RPC_SERVER=True
145146
VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
146147
VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
147148

@@ -464,6 +465,15 @@ function configure_neutron {
464465
# clouds, therefore running without a dedicated RPC worker
465466
# for state reports is more than adequate.
466467
iniset $NEUTRON_CONF DEFAULT rpc_state_report_workers 0
468+
# The default value of "rpc_workers" is None (not defined). If
469+
# "rpc_workers" is explicitly set to 0, the RPC workers process should not
470+
# be executed. NOTE: this service is only executed when WSGI is enabled
471+
# (NEUTRON_DEPLOY_MOD_WSGI=True) for the Neutron server.
472+
local rpc_workers
473+
rpc_workers=$(iniget_multiline /etc/neutron/neutron.conf DEFAULT rpc_workers)
474+
if ! is_service_enabled neutron-rpc-server || [ "$rpc_workers" -eq "0" ]; then
475+
_Q_RUN_RPC_SERVER=False
476+
fi
467477

468478
if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
469479
write_uwsgi_config "$NEUTRON_UWSGI_CONF" "$NEUTRON_BIN_DIR/neutron-api" "/networking"
@@ -651,10 +661,14 @@ function start_neutron_service_and_check {
651661
enable_service neutron-api
652662
run_process neutron-api "$(which uwsgi) --procname-prefix neutron-api --ini $NEUTRON_UWSGI_CONF"
653663
neutron_url=$Q_PROTOCOL://$Q_HOST/
654-
enable_service neutron-rpc-server
664+
if [[ "$_Q_RUN_RPC_SERVER" = True ]]; then
665+
enable_service neutron-rpc-server
666+
fi
655667
enable_service neutron-periodic-workers
656668
_enable_ovn_maintenance
657-
run_process neutron-rpc-server "$NEUTRON_BIN_DIR/neutron-rpc-server $cfg_file_options"
669+
if [[ "$_Q_RUN_RPC_SERVER" = True ]]; then
670+
run_process neutron-rpc-server "$NEUTRON_BIN_DIR/neutron-rpc-server $cfg_file_options"
671+
fi
658672
run_process neutron-periodic-workers "$NEUTRON_BIN_DIR/neutron-periodic-workers $cfg_file_options"
659673
_run_ovn_maintenance
660674
else

0 commit comments

Comments
 (0)