Automatically generate neutron LBaaS configuration files
This adds a new tox environment, genconfig, which generates sample neutron LBaaS configuration file using oslo-config-generator. DocImpact: Update the docs that LBaaS no longer includes static example configuration files. Instead, use tools/generate_config_file_samples.sh to generate them and the files generated now end with .sample extension. Partially-Implements: blueprint autogen-neutron-conf-file Change-Id: I25507f3bc6e995580aa91a912c2cf4110757df15 Partial-bug: #1199963
This commit is contained in:
parent
e1e8bf6667
commit
e719861c00
|
@ -6,6 +6,7 @@ cover/
|
|||
covhtml/
|
||||
dist/
|
||||
doc/build
|
||||
etc/*.sample
|
||||
*.DS_Store
|
||||
*.pyc
|
||||
neutron.egg-info/
|
||||
|
|
|
@ -27,7 +27,10 @@ function neutron_lbaas_configure_common {
|
|||
die $LINENO "Do not enable both Version 1 and Version 2 of LBaaS."
|
||||
fi
|
||||
|
||||
cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf $NEUTRON_LBAAS_CONF
|
||||
# Uses oslo config generator to generate LBaaS sample configuration files
|
||||
(cd $NEUTRON_LBAAS_DIR && exec ./tools/generate_config_file_samples.sh)
|
||||
|
||||
cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample $NEUTRON_LBAAS_CONF
|
||||
|
||||
if is_service_enabled $LBAAS_V1; then
|
||||
inicomment $NEUTRON_LBAAS_CONF service_providers service_provider
|
||||
|
@ -61,7 +64,7 @@ function neutron_lbaas_configure_common {
|
|||
|
||||
function neutron_lbaas_configure_agent {
|
||||
mkdir -p $LBAAS_AGENT_CONF_PATH
|
||||
cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME
|
||||
cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini.sample $LBAAS_AGENT_CONF_FILENAME
|
||||
|
||||
# ovs_use_veth needs to be set before the plugin configuration
|
||||
# occurs to allow plugins to override the setting.
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
To generate the sample neutron LBaaS configuration files, run the following
|
||||
command from the top level of the neutron LBaaS directory:
|
||||
|
||||
tox -e genconfig
|
||||
|
||||
If a 'tox' environment is unavailable, then you can run the following script
|
||||
instead to generate the configuration files:
|
||||
|
||||
./tools/generate_config_file_samples.sh
|
|
@ -0,0 +1,6 @@
|
|||
[DEFAULT]
|
||||
output_file = etc/lbaas_agent.ini.sample
|
||||
wrap_width = 79
|
||||
|
||||
namespace = neutron.lbaas.agent
|
||||
namespace = oslo.log
|
|
@ -0,0 +1,5 @@
|
|||
[DEFAULT]
|
||||
output_file = etc/neutron_lbaas.conf.sample
|
||||
wrap_width = 79
|
||||
|
||||
namespace = neutron.lbaas
|
|
@ -0,0 +1,5 @@
|
|||
[DEFAULT]
|
||||
output_file = etc/services_lbaas.conf.sample
|
||||
wrap_width = 79
|
||||
|
||||
namespace = neutron.lbaas.service
|
|
@ -0,0 +1,91 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import itertools
|
||||
|
||||
import neutron.agent.common.config
|
||||
import neutron.agent.linux.interface
|
||||
import neutron.services.provider_configuration
|
||||
|
||||
import neutron_lbaas.agent.agent
|
||||
import neutron_lbaas.common.cert_manager
|
||||
import neutron_lbaas.common.cert_manager.local_cert_manager
|
||||
import neutron_lbaas.common.keystone
|
||||
import neutron_lbaas.drivers.common.agent_driver_base
|
||||
import neutron_lbaas.drivers.octavia.driver
|
||||
import neutron_lbaas.drivers.radware.base_v2_driver
|
||||
import neutron_lbaas.extensions.loadbalancerv2
|
||||
import neutron_lbaas.services.loadbalancer.agent.agent_manager
|
||||
import neutron_lbaas.services.loadbalancer.drivers.haproxy.jinja_cfg
|
||||
import neutron_lbaas.services.loadbalancer.drivers.haproxy.namespace_driver
|
||||
import neutron_lbaas.services.loadbalancer.drivers.netscaler.netscaler_driver
|
||||
import neutron_lbaas.services.loadbalancer.drivers.radware.driver
|
||||
|
||||
|
||||
def list_agent_opts():
|
||||
return [
|
||||
('DEFAULT',
|
||||
itertools.chain(
|
||||
neutron_lbaas.agent.agent.OPTS,
|
||||
neutron_lbaas.services.loadbalancer.agent.agent_manager.OPTS,
|
||||
neutron.agent.linux.interface.OPTS,
|
||||
neutron.agent.common.config.INTERFACE_DRIVER_OPTS)
|
||||
),
|
||||
('haproxy',
|
||||
neutron_lbaas.services.loadbalancer.drivers.haproxy.
|
||||
namespace_driver.OPTS)
|
||||
]
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [
|
||||
('DEFAULT',
|
||||
neutron_lbaas.drivers.common.agent_driver_base.AGENT_SCHEDULER_OPTS),
|
||||
('quotas',
|
||||
neutron_lbaas.extensions.loadbalancerv2.lbaasv2_quota_opts),
|
||||
('service_auth',
|
||||
neutron_lbaas.common.keystone.OPTS),
|
||||
('service_providers',
|
||||
neutron.services.provider_configuration.serviceprovider_opts),
|
||||
('certificates',
|
||||
itertools.chain(
|
||||
neutron_lbaas.common.cert_manager.cert_manager_opts,
|
||||
neutron_lbaas.common.cert_manager.local_cert_manager.
|
||||
local_cert_manager_opts)
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
def list_service_opts():
|
||||
return [
|
||||
('radware',
|
||||
neutron_lbaas.services.loadbalancer.drivers.radware.driver.
|
||||
driver_opts),
|
||||
('radwarev2',
|
||||
neutron_lbaas.drivers.radware.base_v2_driver.driver_opts),
|
||||
('radwarev2_debug',
|
||||
neutron_lbaas.drivers.radware.base_v2_driver.driver_debug_opts),
|
||||
('netscaler_driver',
|
||||
neutron_lbaas.services.loadbalancer.drivers.netscaler.
|
||||
netscaler_driver.NETSCALER_CC_OPTS),
|
||||
('haproxy',
|
||||
itertools.chain(
|
||||
neutron.agent.common.config.INTERFACE_DRIVER_OPTS,
|
||||
neutron_lbaas.agent.agent.OPTS,
|
||||
neutron_lbaas.services.loadbalancer.drivers.haproxy.
|
||||
namespace_driver.OPTS,
|
||||
neutron_lbaas.services.loadbalancer.drivers.haproxy.jinja_cfg.
|
||||
jinja_opts)
|
||||
),
|
||||
('octavia',
|
||||
neutron_lbaas.drivers.octavia.driver.OPTS)
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
prelude: >
|
||||
Generation of sample Neutron LBaaS configuration files.
|
||||
features:
|
||||
- Neutron LBaaS no longer includes static example configuration files.
|
||||
Instead, use tools/generate_config_file_samples.sh to generate them.
|
||||
The files are generated with a .sample extension.
|
|
@ -54,6 +54,10 @@ neutron.db.alembic_migrations =
|
|||
neutron_lbaas.cert_manager.backend =
|
||||
barbican = neutron_lbaas.common.cert_manager.barbican_cert_manager
|
||||
local = neutron_lbaas.common.cert_manager.local_cert_manager
|
||||
oslo.config.opts =
|
||||
neutron.lbaas = neutron_lbaas.opts:list_opts
|
||||
neutron.lbaas.agent = neutron_lbaas.opts:list_agent_opts
|
||||
neutron.lbaas.service = neutron_lbaas.opts:list_service_opts
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
set -e
|
||||
|
||||
GEN_CMD=oslo-config-generator
|
||||
|
||||
if ! type "$GEN_CMD" > /dev/null; then
|
||||
echo "ERROR: $GEN_CMD not installed on the system."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in `ls etc/oslo-config-generator/*`; do
|
||||
$GEN_CMD --config-file=$file
|
||||
done
|
||||
|
||||
set -x
|
4
tox.ini
4
tox.ini
|
@ -28,6 +28,7 @@ deps =
|
|||
commands =
|
||||
flake8
|
||||
neutron-db-manage --subproject neutron-lbaas --config-file neutron_lbaas/tests/etc/neutron.conf check_migration
|
||||
{[testenv:genconfig]commands}
|
||||
whitelist_externals = sh
|
||||
|
||||
[testenv:i18n]
|
||||
|
@ -101,3 +102,6 @@ passenv = TEMPEST_CONFIG_DIR
|
|||
setenv =
|
||||
OS_TEST_PATH={toxinidir}/neutron_lbaas/tests/tempest/v2/ddt
|
||||
OS_TESTR_CONCURRENCY=1
|
||||
|
||||
[testenv:genconfig]
|
||||
commands = {toxinidir}/tools/generate_config_file_samples.sh
|
||||
|
|
Loading…
Reference in New Issue