fix bug #1156831
Change-Id: Id05929c3114bc385c09fc25179cc15a358d38189
| ... | ... |
@@ -92,6 +92,9 @@ Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
|
| 92 | 92 |
Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
|
| 93 | 93 |
# The name of the default q-l3 router |
| 94 | 94 |
Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1}
|
| 95 |
+# List of config file names in addition to the main plugin config file |
|
| 96 |
+# See _configure_quantum_common() for details about setting it up |
|
| 97 |
+declare -a Q_PLUGIN_EXTRA_CONF_FILES |
|
| 95 | 98 |
|
| 96 | 99 |
if is_service_enabled quantum; then |
| 97 | 100 |
Q_RR_CONF_FILE=$QUANTUM_CONF_DIR/rootwrap.conf |
| ... | ... |
@@ -358,8 +361,14 @@ function install_quantum_agent_packages() {
|
| 358 | 358 |
|
| 359 | 359 |
# Start running processes, including screen |
| 360 | 360 |
function start_quantum_service_and_check() {
|
| 361 |
+ # build config-file options |
|
| 362 |
+ local cfg_file |
|
| 363 |
+ local CFG_FILE_OPTIONS="--config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
| 364 |
+ for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
|
|
| 365 |
+ CFG_FILE_OPTIONS+=" --config-file /$cfg_file" |
|
| 366 |
+ done |
|
| 361 | 367 |
# Start the Quantum service |
| 362 |
- screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
| 368 |
+ screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server $CFG_FILE_OPTIONS" |
|
| 363 | 369 |
echo "Waiting for Quantum to start..." |
| 364 | 370 |
if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then |
| 365 | 371 |
die $LINENO "Quantum did not start" |
| ... | ... |
@@ -405,8 +414,11 @@ function _configure_quantum_common() {
|
| 405 | 405 |
|
| 406 | 406 |
cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF |
| 407 | 407 |
|
| 408 |
- # set plugin-specific variables |
|
| 409 |
- # Q_PLUGIN_CONF_PATH, Q_PLUGIN_CONF_FILENAME, Q_DB_NAME, Q_PLUGIN_CLASS |
|
| 408 |
+ # Set plugin-specific variables Q_DB_NAME, Q_PLUGIN_CLASS. |
|
| 409 |
+ # For main plugin config file, set Q_PLUGIN_CONF_PATH, Q_PLUGIN_CONF_FILENAME. |
|
| 410 |
+ # For addition plugin config files, set Q_PLUGIN_EXTRA_CONF_PATH, |
|
| 411 |
+ # Q_PLUGIN_EXTRA_CONF_FILES. For example: |
|
| 412 |
+ # Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2) |
|
| 410 | 413 |
quantum_plugin_configure_common |
| 411 | 414 |
|
| 412 | 415 |
if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then |
| ... | ... |
@@ -421,6 +433,22 @@ function _configure_quantum_common() {
|
| 421 | 421 |
iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection `database_connection_url $Q_DB_NAME` |
| 422 | 422 |
iniset $QUANTUM_CONF DEFAULT state_path $DATA_DIR/quantum |
| 423 | 423 |
|
| 424 |
+ # If addition config files are set, make sure their path name is set as well |
|
| 425 |
+ if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
|
|
| 426 |
+ die $LINENO "Quantum additional plugin config not set.. exiting" |
|
| 427 |
+ fi |
|
| 428 |
+ |
|
| 429 |
+ # If additional config files exist, copy them over to quantum configuration |
|
| 430 |
+ # directory |
|
| 431 |
+ if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then |
|
| 432 |
+ mkdir -p /$Q_PLUGIN_EXTRA_CONF_PATH |
|
| 433 |
+ local f |
|
| 434 |
+ for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
|
|
| 435 |
+ Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
|
|
| 436 |
+ cp $QUANTUM_DIR/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} /${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
|
|
| 437 |
+ done |
|
| 438 |
+ fi |
|
| 439 |
+ |
|
| 424 | 440 |
_quantum_setup_rootwrap |
| 425 | 441 |
} |
| 426 | 442 |
|