Browse code

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

Ihar Hrachyshka authored on 2017/02/24 05:44:18
Showing 1 changed files
... ...
@@ -70,9 +70,6 @@ NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
70 70
 NEUTRON_ROOTWRAP_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
71 71
 NEUTRON_ROOTWRAP_DAEMON_CMD="sudo $NEUTRON_ROOTWRAP-daemon $NEUTRON_ROOTWRAP_CONF_FILE"
72 72
 
73
-# Add all enabled config files to a single config arg
74
-NEUTRON_CONFIG_ARG=${NEUTRON_CONFIG_ARG:-""}
75
-
76 73
 # Additional neutron api config files
77 74
 declare -a _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS
78 75
 
... ...
@@ -347,7 +344,7 @@ function init_neutron_new {
347 347
     recreate_database neutron
348 348
 
349 349
     # Run Neutron db migrations
350
-    $NEUTRON_BIN_DIR/neutron-db-manage $NEUTRON_CONFIG_ARG upgrade heads
350
+    $NEUTRON_BIN_DIR/neutron-db-manage upgrade heads
351 351
 
352 352
     create_neutron_cache_dir
353 353
 }
... ...
@@ -426,20 +423,19 @@ function start_neutron_api {
426 426
 
427 427
 # start_neutron() - Start running processes, including screen
428 428
 function start_neutron_new {
429
-    _set_config_files
430
-
431 429
     # Start up the neutron agents if enabled
432 430
     # TODO(sc68cal) Make this pluggable so different DevStack plugins for different Neutron plugins
433 431
     # can resolve the $NEUTRON_AGENT_BINARY
434 432
     if is_service_enabled neutron-agent; then
435
-        run_process neutron-agent "$NEUTRON_BIN_DIR/$NEUTRON_AGENT_BINARY $NEUTRON_CONFIG_ARG"
433
+        # TODO(ihrachys) stop loading ml2_conf.ini into agents, instead load agent specific files
434
+        run_process neutron-agent "$NEUTRON_BIN_DIR/$NEUTRON_AGENT_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_CORE_PLUGIN_CONF"
436 435
     fi
437 436
     if is_service_enabled neutron-dhcp; then
438 437
         neutron_plugin_configure_dhcp_agent $NEUTRON_DHCP_CONF
439
-        run_process neutron-dhcp "$NEUTRON_BIN_DIR/$NEUTRON_DHCP_BINARY $NEUTRON_CONFIG_ARG"
438
+        run_process neutron-dhcp "$NEUTRON_BIN_DIR/$NEUTRON_DHCP_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_DHCP_CONF"
440 439
     fi
441 440
     if is_service_enabled neutron-l3; then
442
-        run_process neutron-l3 "$NEUTRON_BIN_DIR/$NEUTRON_L3_BINARY $NEUTRON_CONFIG_ARG"
441
+        run_process neutron-l3 "$NEUTRON_BIN_DIR/$NEUTRON_L3_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_L3_CONF"
443 442
     fi
444 443
     if is_service_enabled neutron-api; then
445 444
         # XXX(sc68cal) - Here's where plugins can wire up their own networks instead
... ...
@@ -454,7 +450,7 @@ function start_neutron_new {
454 454
         fi
455 455
     fi
456 456
     if is_service_enabled neutron-metadata-agent; then
457
-        run_process neutron-metadata-agent "$NEUTRON_BIN_DIR/$NEUTRON_META_BINARY $NEUTRON_CONFIG_ARG"
457
+        run_process neutron-metadata-agent "$NEUTRON_BIN_DIR/$NEUTRON_META_BINARY --config-file $NEUTRON_CONF --config-file $NEUTRON_META_CONF"
458 458
     fi
459 459
 
460 460
     if is_service_enabled neutron-metering; then
... ...
@@ -480,30 +476,6 @@ function stop_neutron_new {
480 480
     fi
481 481
 }
482 482
 
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
-
507 483
 # neutron_service_plugin_class_add() - add service plugin class
508 484
 function neutron_service_plugin_class_add_new {
509 485
     local service_plugin_class=$1