From 30d5fae31548ed998e4c053ba957f95e068eaebc Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Tue, 10 Nov 2015 13:44:15 +0000 Subject: [PATCH] Neutron: Use generated configuration files if available Generate the neutron core sample config files by using the oslo generator. The files are generated with a .sample extension and replace the static example configuration files. Once the generation code is delivered, the static config files will be removed. Change-Id: Ic37a16b6cf8eb92030649f1fc8b198738a8cc104 Related-blueprint: autogen-neutron-conf-file Partial-bug: #1199963 Depends-On: I1c6dc4e7d479f1b7c755597caded24a0f018c712 Co-Authored-By: Louis Taylor --- lib/neutron-legacy | 19 +++++++++++++------ lib/neutron_plugins/services/metering | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/neutron-legacy b/lib/neutron-legacy index d00630af70..a60714f43b 100644 --- a/lib/neutron-legacy +++ b/lib/neutron-legacy @@ -870,7 +870,10 @@ function _create_neutron_conf_dir { function _configure_neutron_common { _create_neutron_conf_dir - cp $NEUTRON_DIR/etc/neutron.conf $NEUTRON_CONF + # Uses oslo config generator to generate core sample configuration files + (cd $NEUTRON_DIR && exec ./tools/generate_config_file_samples.sh) + + cp $NEUTRON_DIR/etc/neutron.conf.sample $NEUTRON_CONF Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE @@ -895,7 +898,9 @@ function _configure_neutron_common { Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME # NOTE(hichihara): Some neutron vendor plugins were already decomposed and # there is no config file in Neutron tree. They should prepare the file in each plugin. - if [ -f $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE ]; then + if [ -f "$NEUTRON_DIR/$Q_PLUGIN_CONF_FILE.sample" ]; then + cp "$NEUTRON_DIR/$Q_PLUGIN_CONF_FILE.sample" /$Q_PLUGIN_CONF_FILE + elif [ -f $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE ]; then cp $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE fi @@ -903,6 +908,8 @@ function _configure_neutron_common { iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron iniset $NEUTRON_CONF DEFAULT use_syslog $SYSLOG iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS + iniset $NEUTRON_CONF oslo_concurrency lock_path $DATA_DIR/neutron/lock + # 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" @@ -959,7 +966,7 @@ function _configure_neutron_debug_command { return fi - cp $NEUTRON_DIR/etc/l3_agent.ini $NEUTRON_TEST_CONFIG_FILE + cp $NEUTRON_DIR/etc/l3_agent.ini.sample $NEUTRON_TEST_CONFIG_FILE iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT verbose False iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False @@ -975,7 +982,7 @@ function _configure_neutron_debug_command { function _configure_neutron_dhcp_agent { - cp $NEUTRON_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE + cp $NEUTRON_DIR/etc/dhcp_agent.ini.sample $Q_DHCP_CONF_FILE iniset $Q_DHCP_CONF_FILE DEFAULT verbose True iniset $Q_DHCP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL @@ -1007,7 +1014,7 @@ function _configure_neutron_l3_agent { neutron_vpn_configure_agent fi - cp $NEUTRON_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE + cp $NEUTRON_DIR/etc/l3_agent.ini.sample $Q_L3_CONF_FILE iniset $Q_L3_CONF_FILE DEFAULT verbose True iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL @@ -1028,7 +1035,7 @@ function _configure_neutron_l3_agent { } function _configure_neutron_metadata_agent { - cp $NEUTRON_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE + cp $NEUTRON_DIR/etc/metadata_agent.ini.sample $Q_META_CONF_FILE iniset $Q_META_CONF_FILE DEFAULT verbose True iniset $Q_META_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL diff --git a/lib/neutron_plugins/services/metering b/lib/neutron_plugins/services/metering index 5fd2fdce44..5b32468d21 100644 --- a/lib/neutron_plugins/services/metering +++ b/lib/neutron_plugins/services/metering @@ -21,7 +21,7 @@ function neutron_agent_metering_configure_agent { METERING_AGENT_CONF_FILENAME="$METERING_AGENT_CONF_PATH/metering_agent.ini" - cp $NEUTRON_DIR/etc/metering_agent.ini $METERING_AGENT_CONF_FILENAME + cp $NEUTRON_DIR/etc/metering_agent.ini.sample $METERING_AGENT_CONF_FILENAME } function neutron_metering_stop {