Add NEUTRON_ENDPOINT_SERVICE_NAME variable to set service name
This option can be used to set name of the service used in the networking service endpoint URL. Depends-On: https://review.opendev.org/c/openstack/grenade/+/850306 Change-Id: I9e9a06eadc1604214c627bd3bda010cc00aaf83d
This commit is contained in:
parent
cf0bf746e9
commit
1a21ccbdf8
18
lib/neutron
18
lib/neutron
@ -114,6 +114,12 @@ NEUTRON_TENANT_VLAN_RANGE=${NEUTRON_TENANT_VLAN_RANGE:-${TENANT_VLAN_RANGE:-100:
|
||||
# Physical network for VLAN network usage.
|
||||
NEUTRON_PHYSICAL_NETWORK=${NEUTRON_PHYSICAL_NETWORK:-}
|
||||
|
||||
# The name of the service in the endpoint URL
|
||||
NEUTRON_ENDPOINT_SERVICE_NAME=${NEUTRON_ENDPOINT_SERVICE_NAME-"networking"}
|
||||
if [[ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" && -z "$NEUTRON_ENDPOINT_SERVICE_NAME" ]]; then
|
||||
NEUTRON_ENDPOINT_SERVICE_NAME="networking"
|
||||
fi
|
||||
|
||||
|
||||
# Additional neutron api config files
|
||||
declare -a -g _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS
|
||||
@ -397,10 +403,13 @@ function create_neutron_accounts_new {
|
||||
local neutron_url
|
||||
|
||||
if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
|
||||
neutron_url=$NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST/networking/
|
||||
neutron_url=$NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST/
|
||||
else
|
||||
neutron_url=$NEUTRON_SERVICE_PROTOCOL://$NEUTRON_SERVICE_HOST:$NEUTRON_SERVICE_PORT/
|
||||
fi
|
||||
if [ ! -z "$NEUTRON_ENDPOINT_SERVICE_NAME" ]; then
|
||||
neutron_url=$neutron_url$NEUTRON_ENDPOINT_SERVICE_NAME
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$ENABLED_SERVICES" =~ "neutron-api" ]]; then
|
||||
@ -481,19 +490,22 @@ function start_neutron_api {
|
||||
|
||||
if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
|
||||
run_process neutron-api "$(which uwsgi) --procname-prefix neutron-api --ini $NEUTRON_UWSGI_CONF"
|
||||
neutron_url=$service_protocol://$NEUTRON_SERVICE_HOST/networking/
|
||||
neutron_url=$service_protocol://$NEUTRON_SERVICE_HOST/
|
||||
enable_service neutron-rpc-server
|
||||
run_process neutron-rpc-server "$NEUTRON_BIN_DIR/neutron-rpc-server $opts"
|
||||
else
|
||||
# Start the Neutron service
|
||||
# TODO(sc68cal) Stop hard coding this
|
||||
run_process neutron-api "$NEUTRON_BIN_DIR/neutron-server $opts"
|
||||
neutron_url=$service_protocol://$NEUTRON_SERVICE_HOST:$service_port
|
||||
neutron_url=$service_protocol://$NEUTRON_SERVICE_HOST:$service_port/
|
||||
# Start proxy if enabled
|
||||
if is_service_enabled tls-proxy; then
|
||||
start_tls_proxy neutron '*' $NEUTRON_SERVICE_PORT $NEUTRON_SERVICE_HOST $NEUTRON_SERVICE_PORT_INT
|
||||
fi
|
||||
fi
|
||||
if [ ! -z "$NEUTRON_ENDPOINT_SERVICE_NAME" ]; then
|
||||
neutron_url=$neutron_url$NEUTRON_ENDPOINT_SERVICE_NAME
|
||||
fi
|
||||
|
||||
if ! wait_for_service $SERVICE_TIMEOUT $neutron_url; then
|
||||
die $LINENO "neutron-api did not start"
|
||||
|
@ -145,6 +145,12 @@ SKIP_STOP_OVN=${SKIP_STOP_OVN:-False}
|
||||
# /etc/neutron is assumed by many of devstack plugins. Do not change.
|
||||
_Q_PLUGIN_EXTRA_CONF_PATH=/etc/neutron
|
||||
|
||||
# The name of the service in the endpoint URL
|
||||
NEUTRON_ENDPOINT_SERVICE_NAME=${NEUTRON_ENDPOINT_SERVICE_NAME-"networking"}
|
||||
if [[ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" && -z "$NEUTRON_ENDPOINT_SERVICE_NAME" ]]; then
|
||||
NEUTRON_ENDPOINT_SERVICE_NAME="networking"
|
||||
fi
|
||||
|
||||
# List of config file names in addition to the main plugin config file
|
||||
# To add additional plugin config files, use ``neutron_server_config_add``
|
||||
# utility function. For example:
|
||||
@ -431,10 +437,13 @@ function create_nova_conf_neutron {
|
||||
function create_mutnauq_accounts {
|
||||
local neutron_url
|
||||
if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
|
||||
neutron_url=$Q_PROTOCOL://$SERVICE_HOST/networking/
|
||||
neutron_url=$Q_PROTOCOL://$SERVICE_HOST/
|
||||
else
|
||||
neutron_url=$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/
|
||||
fi
|
||||
if [ ! -z "$NEUTRON_ENDPOINT_SERVICE_NAME" ]; then
|
||||
neutron_url=$neutron_url$NEUTRON_ENDPOINT_SERVICE_NAME
|
||||
fi
|
||||
|
||||
if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
|
||||
|
||||
@ -538,17 +547,20 @@ function start_neutron_service_and_check {
|
||||
if [ "$NEUTRON_DEPLOY_MOD_WSGI" == "True" ]; then
|
||||
enable_service neutron-api
|
||||
run_process neutron-api "$(which uwsgi) --procname-prefix neutron-api --ini $NEUTRON_UWSGI_CONF"
|
||||
neutron_url=$Q_PROTOCOL://$Q_HOST/networking/
|
||||
neutron_url=$Q_PROTOCOL://$Q_HOST/
|
||||
enable_service neutron-rpc-server
|
||||
run_process neutron-rpc-server "$NEUTRON_BIN_DIR/neutron-rpc-server $cfg_file_options"
|
||||
else
|
||||
run_process q-svc "$NEUTRON_BIN_DIR/neutron-server $cfg_file_options"
|
||||
neutron_url=$service_protocol://$Q_HOST:$service_port
|
||||
neutron_url=$service_protocol://$Q_HOST:$service_port/
|
||||
# Start proxy if enabled
|
||||
if is_service_enabled tls-proxy; then
|
||||
start_tls_proxy neutron '*' $Q_PORT $Q_HOST $Q_PORT_INT
|
||||
fi
|
||||
fi
|
||||
if [ ! -z "$NEUTRON_ENDPOINT_SERVICE_NAME" ]; then
|
||||
neutron_url=$neutron_url$NEUTRON_ENDPOINT_SERVICE_NAME
|
||||
fi
|
||||
echo "Waiting for Neutron to start..."
|
||||
|
||||
local testcmd="wget ${ssl_ca} --no-proxy -q -O- $neutron_url"
|
||||
@ -905,12 +917,25 @@ function _configure_neutron_plugin_agent {
|
||||
neutron_plugin_configure_plugin_agent
|
||||
}
|
||||
|
||||
function _replace_api_paste_composite {
|
||||
local sep
|
||||
sep=$(echo -ne "\x01")
|
||||
# Replace it
|
||||
$sudo sed -i -e "s/\/\: neutronversions_composite/\/"${NEUTRON_ENDPOINT_SERVICE_NAME}"\/\: neutronversions_composite/" "$Q_API_PASTE_FILE"
|
||||
$sudo sed -i -e "s/\/healthcheck\: healthcheck/\/"${NEUTRON_ENDPOINT_SERVICE_NAME}"\/healthcheck\: healthcheck/" "$Q_API_PASTE_FILE"
|
||||
$sudo sed -i -e "s/\/v2.0\: neutronapi_v2_0/\/"${NEUTRON_ENDPOINT_SERVICE_NAME}"\/v2.0\: neutronapi_v2_0/" "$Q_API_PASTE_FILE"
|
||||
}
|
||||
|
||||
# _configure_neutron_service() - Set config files for neutron service
|
||||
# It is called when q-svc is enabled.
|
||||
function _configure_neutron_service {
|
||||
Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini
|
||||
cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
|
||||
|
||||
if [[ -n "$NEUTRON_ENDPOINT_SERVICE_NAME" ]]; then
|
||||
_replace_api_paste_composite
|
||||
fi
|
||||
|
||||
# Update either configuration file with plugin
|
||||
iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user