This single global variable is no longer useful as we have multiple
repositories and devstack plugins nowadays.
Also, add a utility function, neutron_server_config_add, for devstack
plugins to add an extra config file.
Related-Bug: #1599936
Change-Id: I90112823ef96ae2fba97d7b09b00bec8cb816d8d
| ... | ... |
@@ -73,6 +73,9 @@ NEUTRON_ROOTWRAP_DAEMON_CMD="sudo $NEUTRON_ROOTWRAP-daemon $NEUTRON_ROOTWRAP_CON |
| 73 | 73 |
# Add all enabled config files to a single config arg |
| 74 | 74 |
NEUTRON_CONFIG_ARG=${NEUTRON_CONFIG_ARG:-""}
|
| 75 | 75 |
|
| 76 |
+# Additional neutron api config files |
|
| 77 |
+declare -a _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS |
|
| 78 |
+ |
|
| 76 | 79 |
# Functions |
| 77 | 80 |
# --------- |
| 78 | 81 |
|
| ... | ... |
@@ -393,9 +396,17 @@ function start_neutron_api {
|
| 393 | 393 |
service_protocol="http" |
| 394 | 394 |
fi |
| 395 | 395 |
|
| 396 |
+ local opts = "" |
|
| 397 |
+ opts+="--config-file $NEUTRON_CONF" |
|
| 398 |
+ opts+="--config-file $NEUTRON_CORE_PLUGIN_CONF" |
|
| 399 |
+ local cfg_file |
|
| 400 |
+ for cfg_file in ${_NEUTRON_SERVER_EXTRA_CONF_FILES_ABS[@]}; do
|
|
| 401 |
+ opts+=" --config-file $cfg_file" |
|
| 402 |
+ done |
|
| 403 |
+ |
|
| 396 | 404 |
# Start the Neutron service |
| 397 | 405 |
# TODO(sc68cal) Stop hard coding this |
| 398 |
- run_process neutron-api "$NEUTRON_BIN_DIR/neutron-server --config-file $NEUTRON_CONF --config-file $NEUTRON_CORE_PLUGIN_CONF" |
|
| 406 |
+ run_process neutron-api "$NEUTRON_BIN_DIR/neutron-server $ops" |
|
| 399 | 407 |
|
| 400 | 408 |
if is_ssl_enabled_service "neutron"; then |
| 401 | 409 |
ssl_ca="--ca-certificate=${SSL_BUNDLE_FILE}"
|
| ... | ... |
@@ -504,6 +515,10 @@ function neutron_service_plugin_class_add_new {
|
| 504 | 504 |
iniset $NEUTRON_CONF DEFAULT service_plugins $plugins |
| 505 | 505 |
} |
| 506 | 506 |
|
| 507 |
+function neutron_server_config_add_new {
|
|
| 508 |
+ _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS+=($1) |
|
| 509 |
+} |
|
| 510 |
+ |
|
| 507 | 511 |
# Dispatch functions |
| 508 | 512 |
# These are needed for compatibility between the old and new implementations |
| 509 | 513 |
# where there are function name overlaps. These will be removed when |
| ... | ... |
@@ -581,6 +596,15 @@ function install_neutron_agent_packages {
|
| 581 | 581 |
fi |
| 582 | 582 |
} |
| 583 | 583 |
|
| 584 |
+function neutron_server_config_add {
|
|
| 585 |
+ if is_neutron_legacy_enabled; then |
|
| 586 |
+ # Call back to old function |
|
| 587 |
+ mutnauq_server_config_add "$@" |
|
| 588 |
+ else |
|
| 589 |
+ neutron_server_config_add_new "$@" |
|
| 590 |
+ fi |
|
| 591 |
+} |
|
| 592 |
+ |
|
| 584 | 593 |
function start_neutron {
|
| 585 | 594 |
if is_neutron_legacy_enabled; then |
| 586 | 595 |
# Call back to old function |
| ... | ... |
@@ -128,10 +128,24 @@ Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
|
| 128 | 128 |
VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
|
| 129 | 129 |
VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
|
| 130 | 130 |
|
| 131 |
+# The directory which contains files for Q_PLUGIN_EXTRA_CONF_FILES. |
|
| 132 |
+# /etc/neutron is assumed by many of devstack plugins. Do not change. |
|
| 133 |
+_Q_PLUGIN_EXTRA_CONF_PATH=/etc/neutron |
|
| 134 |
+ |
|
| 131 | 135 |
# List of config file names in addition to the main plugin config file |
| 132 |
-# See _configure_neutron_common() for details about setting it up |
|
| 136 |
+# To add additional plugin config files, use ``neutron_server_config_add`` |
|
| 137 |
+# utility function. For example: |
|
| 138 |
+# |
|
| 139 |
+# ``neutron_server_config_add file1`` |
|
| 140 |
+# |
|
| 141 |
+# These config files are relative to ``/etc/neutron``. The above |
|
| 142 |
+# example would specify ``--config-file /etc/neutron/file1`` for |
|
| 143 |
+# neutron server. |
|
| 133 | 144 |
declare -a Q_PLUGIN_EXTRA_CONF_FILES |
| 134 | 145 |
|
| 146 |
+# same as Q_PLUGIN_EXTRA_CONF_FILES, but with absolute path. |
|
| 147 |
+declare -a _Q_PLUGIN_EXTRA_CONF_FILES_ABS |
|
| 148 |
+ |
|
| 135 | 149 |
|
| 136 | 150 |
Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf |
| 137 | 151 |
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |
| ... | ... |
@@ -270,9 +284,23 @@ set +o xtrace |
| 270 | 270 |
# --------- |
| 271 | 271 |
|
| 272 | 272 |
function _determine_config_server {
|
| 273 |
+ if [[ "$Q_PLUGIN_EXTRA_CONF_PATH" != '' ]]; then |
|
| 274 |
+ if [[ "$Q_PLUGIN_EXTRA_CONF_PATH" = "$_Q_PLUGIN_EXTRA_CONF_PATH" ]]; then |
|
| 275 |
+ deprecated "Q_PLUGIN_EXTRA_CONF_PATH is deprecated" |
|
| 276 |
+ else |
|
| 277 |
+ die $LINENO "Q_PLUGIN_EXTRA_CONF_PATH is deprecated" |
|
| 278 |
+ fi |
|
| 279 |
+ fi |
|
| 280 |
+ if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 ]]; then
|
|
| 281 |
+ deprecated "Q_PLUGIN_EXTRA_CONF_FILES is deprecated. Use neutron_server_config_add instead." |
|
| 282 |
+ fi |
|
| 283 |
+ for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
|
|
| 284 |
+ _Q_PLUGIN_EXTRA_CONF_FILES_ABS+=($_Q_PLUGIN_EXTRA_CONF_PATH/$cfg_file) |
|
| 285 |
+ done |
|
| 286 |
+ |
|
| 273 | 287 |
local cfg_file |
| 274 | 288 |
local opts="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
| 275 |
- for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
|
|
| 289 |
+ for cfg_file in ${_Q_PLUGIN_EXTRA_CONF_FILES_ABS[@]}; do
|
|
| 276 | 290 |
opts+=" --config-file $cfg_file" |
| 277 | 291 |
done |
| 278 | 292 |
echo "$opts" |
| ... | ... |
@@ -668,11 +696,6 @@ function _configure_neutron_common {
|
| 668 | 668 |
|
| 669 | 669 |
# Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``. |
| 670 | 670 |
# For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``. |
| 671 |
- # For additional plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH`` and |
|
| 672 |
- # ``Q_PLUGIN_EXTRA_CONF_FILES``. For example: |
|
| 673 |
- # |
|
| 674 |
- # ``Q_PLUGIN_EXTRA_CONF_PATH=/path/to/plugins`` |
|
| 675 |
- # ``Q_PLUGIN_EXTRA_CONF_FILES=(file1 file2)`` |
|
| 676 | 671 |
neutron_plugin_configure_common |
| 677 | 672 |
|
| 678 | 673 |
if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then |
| ... | ... |
@@ -699,20 +722,6 @@ function _configure_neutron_common {
|
| 699 | 699 |
# NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation |
| 700 | 700 |
iniset $NEUTRON_CONF nova region_name $REGION_NAME |
| 701 | 701 |
|
| 702 |
- # If addition config files are set, make sure their path name is set as well |
|
| 703 |
- if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
|
|
| 704 |
- die $LINENO "Neutron additional plugin config not set.. exiting" |
|
| 705 |
- fi |
|
| 706 |
- |
|
| 707 |
- # If additional config files exist, copy them over to neutron configuration |
|
| 708 |
- # directory |
|
| 709 |
- if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then |
|
| 710 |
- local f |
|
| 711 |
- for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
|
|
| 712 |
- Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
|
|
| 713 |
- done |
|
| 714 |
- fi |
|
| 715 |
- |
|
| 716 | 702 |
if [ "$VIRT_DRIVER" = 'fake' ]; then |
| 717 | 703 |
# Disable arbitrary limits |
| 718 | 704 |
iniset $NEUTRON_CONF quotas quota_network -1 |
| ... | ... |
@@ -863,6 +872,11 @@ function _neutron_service_plugin_class_add {
|
| 863 | 863 |
fi |
| 864 | 864 |
} |
| 865 | 865 |
|
| 866 |
+# mutnauq_server_config_add() - add server config file |
|
| 867 |
+function mutnauq_server_config_add {
|
|
| 868 |
+ _Q_PLUGIN_EXTRA_CONF_FILES_ABS+=($1) |
|
| 869 |
+} |
|
| 870 |
+ |
|
| 866 | 871 |
# _neutron_deploy_rootwrap_filters() - deploy rootwrap filters to $Q_CONF_ROOTWRAP_D (owned by root). |
| 867 | 872 |
function _neutron_deploy_rootwrap_filters {
|
| 868 | 873 |
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |