Merge "lib/neutron: Migrate neutron to WSGI module path"
diff --git a/lib/neutron b/lib/neutron
index 6336795..3d40472 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -143,6 +143,7 @@
 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}
 
@@ -465,6 +466,15 @@
     # 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 [ "$rpc_workers" == "0" ]; then
+        _Q_RUN_RPC_SERVER=False
+    fi
 
     if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
         write_uwsgi_config "$NEUTRON_UWSGI_CONF" "$NEUTRON_UWSGI" "/networking" "" "neutron-api"
@@ -652,10 +662,14 @@
         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