Refactoring config options for l3 ha agent opts
Refactoring l3 ha agent options to be in neutron/conf/agent/l3. This would allow centralization of all configuration options and provides an easy way to import. Partial-Bug: #1563069 Change-Id: I2d6bd6beb0d1658baf88c49b954d2db3136e0c8d
This commit is contained in:
parent
e87b3faf34
commit
2823c2e569
|
@ -13,46 +13,27 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import debtcollector
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from neutron._i18n import _, _LI
|
from neutron._i18n import _LI
|
||||||
from neutron.agent.linux import keepalived
|
|
||||||
from neutron.agent.linux import utils as agent_utils
|
from neutron.agent.linux import utils as agent_utils
|
||||||
from neutron.common import utils as common_utils
|
from neutron.common import utils as common_utils
|
||||||
|
from neutron.conf.agent.l3 import ha as ha_conf
|
||||||
from neutron.notifiers import batch_notifier
|
from neutron.notifiers import batch_notifier
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
KEEPALIVED_STATE_CHANGE_SERVER_BACKLOG = 4096
|
KEEPALIVED_STATE_CHANGE_SERVER_BACKLOG = 4096
|
||||||
|
|
||||||
OPTS = [
|
debtcollector.deprecate(
|
||||||
cfg.StrOpt('ha_confs_path',
|
'Moved l3 agent ha opts to %s' % ha_conf.__name__,
|
||||||
default='$state_path/ha_confs',
|
version="newton", removal_version="ocata")
|
||||||
help=_('Location to store keepalived/conntrackd '
|
OPTS = ha_conf.OPTS
|
||||||
'config files')),
|
|
||||||
cfg.StrOpt('ha_vrrp_auth_type',
|
|
||||||
default='PASS',
|
|
||||||
choices=keepalived.VALID_AUTH_TYPES,
|
|
||||||
help=_('VRRP authentication type')),
|
|
||||||
cfg.StrOpt('ha_vrrp_auth_password',
|
|
||||||
help=_('VRRP authentication password'),
|
|
||||||
secret=True),
|
|
||||||
cfg.IntOpt('ha_vrrp_advert_int',
|
|
||||||
default=2,
|
|
||||||
help=_('The advertisement interval in seconds')),
|
|
||||||
cfg.IntOpt('ha_keepalived_state_change_server_threads',
|
|
||||||
default=(1 + common_utils.cpu_count()) // 2,
|
|
||||||
min=1,
|
|
||||||
help=_('Number of concurrent threads for '
|
|
||||||
'keepalived server connection requests.'
|
|
||||||
'More threads create a higher CPU load '
|
|
||||||
'on the agent node.')),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class KeepalivedStateChangeHandler(object):
|
class KeepalivedStateChangeHandler(object):
|
||||||
|
|
|
@ -20,7 +20,6 @@ from oslo_config import cfg
|
||||||
from oslo_service import service
|
from oslo_service import service
|
||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.agent.l3 import ha
|
|
||||||
from neutron.agent.linux import external_process
|
from neutron.agent.linux import external_process
|
||||||
from neutron.agent.linux import interface
|
from neutron.agent.linux import interface
|
||||||
from neutron.agent.linux import pd
|
from neutron.agent.linux import pd
|
||||||
|
@ -29,6 +28,7 @@ from neutron.agent.metadata import config as metadata_config
|
||||||
from neutron.common import config as common_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron.conf.agent.l3 import config as l3_config
|
from neutron.conf.agent.l3 import config as l3_config
|
||||||
|
from neutron.conf.agent.l3 import ha as ha_conf
|
||||||
from neutron import service as neutron_service
|
from neutron import service as neutron_service
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ def register_opts(conf):
|
||||||
l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
|
l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
|
||||||
conf.register_opts(metadata_config.DRIVER_OPTS)
|
conf.register_opts(metadata_config.DRIVER_OPTS)
|
||||||
conf.register_opts(metadata_config.SHARED_OPTS)
|
conf.register_opts(metadata_config.SHARED_OPTS)
|
||||||
conf.register_opts(ha.OPTS)
|
ha_conf.register_l3_agent_ha_opts(conf)
|
||||||
config.register_interface_driver_opts_helper(conf)
|
config.register_interface_driver_opts_helper(conf)
|
||||||
config.register_agent_state_opts_helper(conf)
|
config.register_agent_state_opts_helper(conf)
|
||||||
conf.register_opts(interface.OPTS)
|
conf.register_opts(interface.OPTS)
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
# Copyright (c) 2014 OpenStack Foundation.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from neutron._i18n import _
|
||||||
|
from neutron.agent.linux import keepalived
|
||||||
|
from neutron.common import utils as common_utils
|
||||||
|
|
||||||
|
|
||||||
|
OPTS = [
|
||||||
|
cfg.StrOpt('ha_confs_path',
|
||||||
|
default='$state_path/ha_confs',
|
||||||
|
help=_('Location to store keepalived/conntrackd '
|
||||||
|
'config files')),
|
||||||
|
cfg.StrOpt('ha_vrrp_auth_type',
|
||||||
|
default='PASS',
|
||||||
|
choices=keepalived.VALID_AUTH_TYPES,
|
||||||
|
help=_('VRRP authentication type')),
|
||||||
|
cfg.StrOpt('ha_vrrp_auth_password',
|
||||||
|
help=_('VRRP authentication password'),
|
||||||
|
secret=True),
|
||||||
|
cfg.IntOpt('ha_vrrp_advert_int',
|
||||||
|
default=2,
|
||||||
|
help=_('The advertisement interval in seconds')),
|
||||||
|
cfg.IntOpt('ha_keepalived_state_change_server_threads',
|
||||||
|
default=(1 + common_utils.cpu_count()) // 2,
|
||||||
|
min=1,
|
||||||
|
help=_('Number of concurrent threads for '
|
||||||
|
'keepalived server connection requests.'
|
||||||
|
'More threads create a higher CPU load '
|
||||||
|
'on the agent node.')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register_l3_agent_ha_opts(cfg=cfg.CONF):
|
||||||
|
cfg.register_opts(OPTS)
|
|
@ -19,7 +19,6 @@ from oslo_config import cfg
|
||||||
|
|
||||||
import neutron.agent.agent_extensions_manager
|
import neutron.agent.agent_extensions_manager
|
||||||
import neutron.agent.common.config
|
import neutron.agent.common.config
|
||||||
import neutron.agent.l3.ha
|
|
||||||
import neutron.agent.linux.interface
|
import neutron.agent.linux.interface
|
||||||
import neutron.agent.linux.pd
|
import neutron.agent.linux.pd
|
||||||
import neutron.agent.linux.ra
|
import neutron.agent.linux.ra
|
||||||
|
@ -29,6 +28,7 @@ import neutron.agent.securitygroups_rpc
|
||||||
import neutron.common.cache_utils
|
import neutron.common.cache_utils
|
||||||
import neutron.conf.agent.dhcp
|
import neutron.conf.agent.dhcp
|
||||||
import neutron.conf.agent.l3.config
|
import neutron.conf.agent.l3.config
|
||||||
|
import neutron.conf.agent.l3.ha
|
||||||
import neutron.conf.agent.ovs_conf
|
import neutron.conf.agent.ovs_conf
|
||||||
import neutron.conf.common
|
import neutron.conf.common
|
||||||
import neutron.conf.extensions.allowedaddresspairs
|
import neutron.conf.extensions.allowedaddresspairs
|
||||||
|
@ -201,7 +201,7 @@ def list_l3_agent_opts():
|
||||||
itertools.chain(
|
itertools.chain(
|
||||||
neutron.conf.agent.l3.config.OPTS,
|
neutron.conf.agent.l3.config.OPTS,
|
||||||
neutron.conf.service.service_opts,
|
neutron.conf.service.service_opts,
|
||||||
neutron.agent.l3.ha.OPTS,
|
neutron.conf.agent.l3.ha.OPTS,
|
||||||
neutron.agent.linux.pd.OPTS,
|
neutron.agent.linux.pd.OPTS,
|
||||||
neutron.agent.linux.ra.OPTS)
|
neutron.agent.linux.ra.OPTS)
|
||||||
)
|
)
|
||||||
|
|
|
@ -34,7 +34,6 @@ from neutron.agent.common import config as agent_config
|
||||||
from neutron.agent.l3 import agent as l3_agent
|
from neutron.agent.l3 import agent as l3_agent
|
||||||
from neutron.agent.l3 import dvr_edge_router as dvr_router
|
from neutron.agent.l3 import dvr_edge_router as dvr_router
|
||||||
from neutron.agent.l3 import dvr_snat_ns
|
from neutron.agent.l3 import dvr_snat_ns
|
||||||
from neutron.agent.l3 import ha
|
|
||||||
from neutron.agent.l3 import legacy_router
|
from neutron.agent.l3 import legacy_router
|
||||||
from neutron.agent.l3 import link_local_allocator as lla
|
from neutron.agent.l3 import link_local_allocator as lla
|
||||||
from neutron.agent.l3 import namespaces
|
from neutron.agent.l3 import namespaces
|
||||||
|
@ -51,6 +50,7 @@ from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.common import constants as n_const
|
from neutron.common import constants as n_const
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
from neutron.conf.agent.l3 import config as l3_config
|
from neutron.conf.agent.l3 import config as l3_config
|
||||||
|
from neutron.conf.agent.l3 import ha as ha_conf
|
||||||
from neutron.conf import common as base_config
|
from neutron.conf import common as base_config
|
||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron.plugins.common import constants as p_const
|
from neutron.plugins.common import constants as p_const
|
||||||
|
@ -73,7 +73,7 @@ class BasicRouterOperationsFramework(base.BaseTestCase):
|
||||||
log.register_options(self.conf)
|
log.register_options(self.conf)
|
||||||
self.conf.register_opts(agent_config.AGENT_STATE_OPTS, 'AGENT')
|
self.conf.register_opts(agent_config.AGENT_STATE_OPTS, 'AGENT')
|
||||||
l3_config.register_l3_agent_config_opts(l3_config.OPTS, self.conf)
|
l3_config.register_l3_agent_config_opts(l3_config.OPTS, self.conf)
|
||||||
self.conf.register_opts(ha.OPTS)
|
ha_conf.register_l3_agent_ha_opts(self.conf)
|
||||||
agent_config.register_interface_driver_opts_helper(self.conf)
|
agent_config.register_interface_driver_opts_helper(self.conf)
|
||||||
agent_config.register_process_monitor_opts(self.conf)
|
agent_config.register_process_monitor_opts(self.conf)
|
||||||
agent_config.register_availability_zone_opts_helper(self.conf)
|
agent_config.register_availability_zone_opts_helper(self.conf)
|
||||||
|
|
|
@ -22,7 +22,6 @@ from oslo_utils import uuidutils
|
||||||
from neutron.agent.common import config as agent_config
|
from neutron.agent.common import config as agent_config
|
||||||
from neutron.agent.l3 import agent as l3_agent
|
from neutron.agent.l3 import agent as l3_agent
|
||||||
from neutron.agent.l3 import dvr_local_router as dvr_router
|
from neutron.agent.l3 import dvr_local_router as dvr_router
|
||||||
from neutron.agent.l3 import ha
|
|
||||||
from neutron.agent.l3 import link_local_allocator as lla
|
from neutron.agent.l3 import link_local_allocator as lla
|
||||||
from neutron.agent.l3 import router_info
|
from neutron.agent.l3 import router_info
|
||||||
from neutron.agent.linux import external_process
|
from neutron.agent.linux import external_process
|
||||||
|
@ -31,6 +30,7 @@ from neutron.agent.linux import ip_lib
|
||||||
from neutron.common import constants as n_const
|
from neutron.common import constants as n_const
|
||||||
from neutron.common import utils as common_utils
|
from neutron.common import utils as common_utils
|
||||||
from neutron.conf.agent.l3 import config as l3_config
|
from neutron.conf.agent.l3 import config as l3_config
|
||||||
|
from neutron.conf.agent.l3 import ha as ha_conf
|
||||||
from neutron.conf import common as base_config
|
from neutron.conf import common as base_config
|
||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
@ -51,7 +51,7 @@ class TestDvrRouterOperations(base.BaseTestCase):
|
||||||
log.register_options(self.conf)
|
log.register_options(self.conf)
|
||||||
self.conf.register_opts(agent_config.AGENT_STATE_OPTS, 'AGENT')
|
self.conf.register_opts(agent_config.AGENT_STATE_OPTS, 'AGENT')
|
||||||
l3_config.register_l3_agent_config_opts(l3_config.OPTS, self.conf)
|
l3_config.register_l3_agent_config_opts(l3_config.OPTS, self.conf)
|
||||||
self.conf.register_opts(ha.OPTS)
|
ha_conf.register_l3_agent_ha_opts(self.conf)
|
||||||
agent_config.register_interface_driver_opts_helper(self.conf)
|
agent_config.register_interface_driver_opts_helper(self.conf)
|
||||||
agent_config.register_process_monitor_opts(self.conf)
|
agent_config.register_process_monitor_opts(self.conf)
|
||||||
self.conf.register_opts(interface.OPTS)
|
self.conf.register_opts(interface.OPTS)
|
||||||
|
|
|
@ -19,12 +19,12 @@ from oslo_utils import uuidutils
|
||||||
|
|
||||||
from neutron.agent.common import config as agent_config
|
from neutron.agent.common import config as agent_config
|
||||||
from neutron.agent.l3 import agent as l3_agent
|
from neutron.agent.l3 import agent as l3_agent
|
||||||
from neutron.agent.l3 import ha as l3_ha_agent
|
|
||||||
from neutron.agent.l3 import router_info
|
from neutron.agent.l3 import router_info
|
||||||
from neutron.agent.metadata import config
|
from neutron.agent.metadata import config
|
||||||
from neutron.agent.metadata import driver as metadata_driver
|
from neutron.agent.metadata import driver as metadata_driver
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.conf.agent.l3 import config as l3_config
|
from neutron.conf.agent.l3 import config as l3_config
|
||||||
|
from neutron.conf.agent.l3 import ha as ha_conf
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class TestMetadataDriverProcess(base.BaseTestCase):
|
||||||
'._init_ha_conf_path').start()
|
'._init_ha_conf_path').start()
|
||||||
|
|
||||||
l3_config.register_l3_agent_config_opts(l3_config.OPTS, cfg.CONF)
|
l3_config.register_l3_agent_config_opts(l3_config.OPTS, cfg.CONF)
|
||||||
cfg.CONF.register_opts(l3_ha_agent.OPTS)
|
ha_conf.register_l3_agent_ha_opts()
|
||||||
cfg.CONF.register_opts(config.SHARED_OPTS)
|
cfg.CONF.register_opts(config.SHARED_OPTS)
|
||||||
cfg.CONF.register_opts(config.DRIVER_OPTS)
|
cfg.CONF.register_opts(config.DRIVER_OPTS)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue