Skip to content

Commit 19f4b3f

Browse files
author
Ihar Hrachyshka
committed
lib/neutron: stop loading all config files into all processes
DHCP agent should not load core plugin config file; L3 agent has no interest in metadata agent configuration file; etc. It's a mistake to form a single global list of configuration files and pass it into all processes. Every process should have its own list, that may or may not have some files in common with other processes. The only file that is common to all neutron processes is neutron.conf, and we could in theory keep it into the common list. But I decided at this point it's better to be explicit about what's loaded into services. Also the order of arguments is important, and neutron.conf should always be the first CLI argument, which is hard to achieve by keeping neutron.conf file in the global list. Plugins may be interested in loading additional files into neutron processes. For example, dragonflow needs to load /etc/neutron/dragonflow.ini into neutron-server. But we should not necessarily load all those files into all processes, so such extendable lists should be per process. Besides, neutron_server_config_add_new is already available to use to append additional configuration files for neutron-server. That's why the patch completely kills the NEUTRON_CONFIG_ARG variable. Depends-On: I4bd54a41a45486a5601373f9a9cce74d7686d1aa Change-Id: Ia3c3862399bba335db5edf9ea70f850fb2638d09
1 parent 0e1e781 commit 19f4b3f

1 file changed

Lines changed: 6 additions & 34 deletions

File tree

lib/neutron

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
7070
NEUTRON_ROOTWRAP_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
7171
NEUTRON_ROOTWRAP_DAEMON_CMD="sudo $NEUTRON_ROOTWRAP-daemon $NEUTRON_ROOTWRAP_CONF_FILE"
7272

73-
# Add all enabled config files to a single config arg
74-
NEUTRON_CONFIG_ARG=${NEUTRON_CONFIG_ARG:-""}
75-
7673
# Additional neutron api config files
7774
declare -a _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS
7875

@@ -347,7 +344,7 @@ function init_neutron_new {
347344
recreate_database neutron
348345

349346
# Run Neutron db migrations
350-
$NEUTRON_BIN_DIR/neutron-db-manage $NEUTRON_CONFIG_ARG upgrade heads
347+
$NEUTRON_BIN_DIR/neutron-db-manage upgrade heads
351348

352349
create_neutron_cache_dir
353350
}
@@ -426,20 +423,19 @@ function start_neutron_api {
426423

427424
# start_neutron() - Start running processes, including screen
428425
function start_neutron_new {
429-
_set_config_files
430-
431426
# Start up the neutron agents if enabled
432427
# TODO(sc68cal) Make this pluggable so different DevStack plugins for different Neutron plugins
433428
# can resolve the $NEUTRON_AGENT_BINARY
434429
if is_service_enabled neutron-agent; then
435-
run_process neutron-agent "$NEUTRON_BIN_DIR/$NEUTRON_AGENT_BINARY $NEUTRON_CONFIG_ARG"
430+
# TODO(ihrachys) stop loading ml2_conf.ini into agents, instead load agent specific files
431+
run_process neutron-agent "$NEUTRON_BIN_DIR/$NEUTRON_AGENT_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_CORE_PLUGIN_CONF"
436432
fi
437433
if is_service_enabled neutron-dhcp; then
438434
neutron_plugin_configure_dhcp_agent $NEUTRON_DHCP_CONF
439-
run_process neutron-dhcp "$NEUTRON_BIN_DIR/$NEUTRON_DHCP_BINARY $NEUTRON_CONFIG_ARG"
435+
run_process neutron-dhcp "$NEUTRON_BIN_DIR/$NEUTRON_DHCP_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_DHCP_CONF"
440436
fi
441437
if is_service_enabled neutron-l3; then
442-
run_process neutron-l3 "$NEUTRON_BIN_DIR/$NEUTRON_L3_BINARY $NEUTRON_CONFIG_ARG"
438+
run_process neutron-l3 "$NEUTRON_BIN_DIR/$NEUTRON_L3_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_L3_CONF"
443439
fi
444440
if is_service_enabled neutron-api; then
445441
# XXX(sc68cal) - Here's where plugins can wire up their own networks instead
@@ -454,7 +450,7 @@ function start_neutron_new {
454450
fi
455451
fi
456452
if is_service_enabled neutron-metadata-agent; then
457-
run_process neutron-metadata-agent "$NEUTRON_BIN_DIR/$NEUTRON_META_BINARY $NEUTRON_CONFIG_ARG"
453+
run_process neutron-metadata-agent "$NEUTRON_BIN_DIR/$NEUTRON_META_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_META_CONF"
458454
fi
459455

460456
if is_service_enabled neutron-metering; then
@@ -480,30 +476,6 @@ function stop_neutron_new {
480476
fi
481477
}
482478

483-
# Compile the lost of enabled config files
484-
function _set_config_files {
485-
486-
NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_CONF"
487-
488-
#TODO(sc68cal) OVS and LB agent uses settings in NEUTRON_CORE_PLUGIN_CONF (ml2_conf.ini) but others may not
489-
if is_service_enabled neutron-agent; then
490-
NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_CORE_PLUGIN_CONF"
491-
fi
492-
493-
if is_service_enabled neutron-dhcp; then
494-
NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_DHCP_CONF"
495-
fi
496-
497-
if is_service_enabled neutron-l3; then
498-
NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_L3_CONF"
499-
fi
500-
501-
if is_service_enabled neutron-metadata-agent; then
502-
NEUTRON_CONFIG_ARG+=" --config-file $NEUTRON_META_CONF"
503-
fi
504-
505-
}
506-
507479
# neutron_service_plugin_class_add() - add service plugin class
508480
function neutron_service_plugin_class_add_new {
509481
local service_plugin_class=$1

0 commit comments

Comments
 (0)