Merge "Deprecate Q_PLUGIN_EXTRA_CONF_PATH"

This commit is contained in:
Jenkins 2017-01-10 15:53:50 +00:00 committed by Gerrit Code Review
commit 6db9e7b0ab
2 changed files with 60 additions and 22 deletions

View File

@ -73,6 +73,9 @@ NEUTRON_ROOTWRAP_DAEMON_CMD="sudo $NEUTRON_ROOTWRAP-daemon $NEUTRON_ROOTWRAP_CON
# Add all enabled config files to a single config arg
NEUTRON_CONFIG_ARG=${NEUTRON_CONFIG_ARG:-""}
# Additional neutron api config files
declare -a _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS
# Functions
# ---------
@ -393,9 +396,17 @@ function start_neutron_api {
service_protocol="http"
fi
local opts = ""
opts+="--config-file $NEUTRON_CONF"
opts+="--config-file $NEUTRON_CORE_PLUGIN_CONF"
local cfg_file
for cfg_file in ${_NEUTRON_SERVER_EXTRA_CONF_FILES_ABS[@]}; do
opts+=" --config-file $cfg_file"
done
# Start the Neutron service
# TODO(sc68cal) Stop hard coding this
run_process neutron-api "$NEUTRON_BIN_DIR/neutron-server --config-file $NEUTRON_CONF --config-file $NEUTRON_CORE_PLUGIN_CONF"
run_process neutron-api "$NEUTRON_BIN_DIR/neutron-server $ops"
if is_ssl_enabled_service "neutron"; then
ssl_ca="--ca-certificate=${SSL_BUNDLE_FILE}"
@ -504,6 +515,10 @@ function neutron_service_plugin_class_add_new {
iniset $NEUTRON_CONF DEFAULT service_plugins $plugins
}
function neutron_server_config_add_new {
_NEUTRON_SERVER_EXTRA_CONF_FILES_ABS+=($1)
}
# Dispatch functions
# These are needed for compatibility between the old and new implementations
# where there are function name overlaps. These will be removed when
@ -581,6 +596,15 @@ function install_neutron_agent_packages {
fi
}
function neutron_server_config_add {
if is_neutron_legacy_enabled; then
# Call back to old function
mutnauq_server_config_add "$@"
else
neutron_server_config_add_new "$@"
fi
}
function start_neutron {
if is_neutron_legacy_enabled; then
# Call back to old function

View File

@ -128,10 +128,24 @@ Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
# The directory which contains files for Q_PLUGIN_EXTRA_CONF_FILES.
# /etc/neutron is assumed by many of devstack plugins. Do not change.
_Q_PLUGIN_EXTRA_CONF_PATH=/etc/neutron
# List of config file names in addition to the main plugin config file
# See _configure_neutron_common() for details about setting it up
# To add additional plugin config files, use ``neutron_server_config_add``
# utility function. For example:
#
# ``neutron_server_config_add file1``
#
# These config files are relative to ``/etc/neutron``. The above
# example would specify ``--config-file /etc/neutron/file1`` for
# neutron server.
declare -a Q_PLUGIN_EXTRA_CONF_FILES
# same as Q_PLUGIN_EXTRA_CONF_FILES, but with absolute path.
declare -a _Q_PLUGIN_EXTRA_CONF_FILES_ABS
Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
@ -270,9 +284,23 @@ set +o xtrace
# ---------
function _determine_config_server {
if [[ "$Q_PLUGIN_EXTRA_CONF_PATH" != '' ]]; then
if [[ "$Q_PLUGIN_EXTRA_CONF_PATH" = "$_Q_PLUGIN_EXTRA_CONF_PATH" ]]; then
deprecated "Q_PLUGIN_EXTRA_CONF_PATH is deprecated"
else
die $LINENO "Q_PLUGIN_EXTRA_CONF_PATH is deprecated"
fi
fi
if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 ]]; then
deprecated "Q_PLUGIN_EXTRA_CONF_FILES is deprecated. Use neutron_server_config_add instead."
fi
for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
_Q_PLUGIN_EXTRA_CONF_FILES_ABS+=($_Q_PLUGIN_EXTRA_CONF_PATH/$cfg_file)
done
local cfg_file
local opts="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
for cfg_file in ${_Q_PLUGIN_EXTRA_CONF_FILES_ABS[@]}; do
opts+=" --config-file $cfg_file"
done
echo "$opts"
@ -668,11 +696,6 @@ function _configure_neutron_common {
# Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``.
# For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``.
# For additional plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH`` and
# ``Q_PLUGIN_EXTRA_CONF_FILES``. For example:
#
# ``Q_PLUGIN_EXTRA_CONF_PATH=/path/to/plugins``
# ``Q_PLUGIN_EXTRA_CONF_FILES=(file1 file2)``
neutron_plugin_configure_common
if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then
@ -699,20 +722,6 @@ function _configure_neutron_common {
# NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation
iniset $NEUTRON_CONF nova region_name $REGION_NAME
# If addition config files are set, make sure their path name is set as well
if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
die $LINENO "Neutron additional plugin config not set.. exiting"
fi
# If additional config files exist, copy them over to neutron configuration
# directory
if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then
local f
for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
done
fi
if [ "$VIRT_DRIVER" = 'fake' ]; then
# Disable arbitrary limits
iniset $NEUTRON_CONF quotas quota_network -1
@ -863,6 +872,11 @@ function _neutron_service_plugin_class_add {
fi
}
# mutnauq_server_config_add() - add server config file
function mutnauq_server_config_add {
_Q_PLUGIN_EXTRA_CONF_FILES_ABS+=($1)
}
# _neutron_deploy_rootwrap_filters() - deploy rootwrap filters to $Q_CONF_ROOTWRAP_D (owned by root).
function _neutron_deploy_rootwrap_filters {
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then