Merge "Remove the deprecated config 'router_id'"

This commit is contained in:
Jenkins 2016-06-23 20:44:51 +00:00 committed by Gerrit Code Review
commit b9c2f5444d
7 changed files with 15 additions and 88 deletions

View File

@ -401,9 +401,6 @@ class L3NATAgent(ha.AgentMixin,
self.conf.external_network_bridge)
return
if self.conf.router_id and router['id'] != self.conf.router_id:
raise n_exc.RouterNotCompatibleWithAgent(router_id=router['id'])
# Either ex_net_id or handle_internal_only_routers must be set
ex_net_id = (router['external_gateway_info'] or {}).get('network_id')
if not ex_net_id and not self.conf.handle_internal_only_routers:
@ -535,8 +532,7 @@ class L3NATAgent(ha.AgentMixin,
timestamp = timeutils.utcnow()
try:
router_ids = ([self.conf.router_id] if self.conf.router_id else
self.plugin_rpc.get_router_ids(context))
router_ids = self.plugin_rpc.get_router_ids(context)
# fetch routers by chunks to reduce the load on server and to
# start router processing earlier
for i in range(0, len(router_ids), self.sync_routers_chunk_size):
@ -624,7 +620,6 @@ class L3NATAgentWithStateReport(L3NATAgent):
'topic': topics.L3_AGENT,
'configurations': {
'agent_mode': self.conf.agent_mode,
'router_id': self.conf.router_id,
'handle_internal_only_routers':
self.conf.handle_internal_only_routers,
'external_network_bridge': self.conf.external_network_bridge,

View File

@ -45,10 +45,6 @@ OPTS = [
default=3,
help=_("Send this many gratuitous ARPs for HA setup, if "
"less than or equal to 0, the feature is disabled")),
cfg.StrOpt('router_id', default='',
deprecated_for_removal=True,
help=_("If non-empty, the l3 agent can only configure a router "
"that has the matching router ID.")),
cfg.BoolOpt('handle_internal_only_routers',
default=True,
help=_("Indicates that this L3 agent should also handle "

View File

@ -55,7 +55,7 @@ class FakePlugin(common_db_mixin.CommonDbMixin,
def _get_l3_agent_dict(host, agent_mode, internal_only=True,
ext_net_id='', ext_bridge='', router_id=None,
ext_net_id='', ext_bridge='',
az=DEFAULT_AZ):
return {
'agent_type': constants.AGENT_TYPE_L3,
@ -66,8 +66,7 @@ def _get_l3_agent_dict(host, agent_mode, internal_only=True,
'configurations': {'agent_mode': agent_mode,
'handle_internal_only_routers': internal_only,
'external_network_bridge': ext_bridge,
'gateway_external_network_id': ext_net_id,
'router_id': router_id}}
'gateway_external_network_id': ext_net_id}}
def _register_agent(agent, plugin=None):
@ -81,9 +80,9 @@ def _register_agent(agent, plugin=None):
def register_l3_agent(host=HOST, agent_mode=n_const.L3_AGENT_MODE_LEGACY,
internal_only=True, ext_net_id='', ext_bridge='',
router_id=None, az=DEFAULT_AZ):
az=DEFAULT_AZ):
agent = _get_l3_agent_dict(host, agent_mode, internal_only, ext_net_id,
ext_bridge, router_id, az)
ext_bridge, az)
return _register_agent(agent)

View File

@ -1910,10 +1910,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
def test_disable_metadata_proxy_spawn(self):
self._configure_metadata_proxy(enableflag=False)
def test_router_id_specified_in_conf(self):
self.conf.set_override('router_id', '1234')
self._configure_metadata_proxy()
def _test_process_routers_update_rpc_timeout(self, ext_net_call=False,
ext_net_call_failed=False):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
@ -2133,7 +2129,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
self.assertFalse(agent.namespaces_manager._clean_stale)
def test_cleanup_namespace(self):
self.conf.set_override('router_id', None)
stale_namespaces = [namespaces.NS_PREFIX + 'foo',
namespaces.NS_PREFIX + 'bar',
dvr_snat_ns.SNAT_NS_PREFIX + 'foo']
@ -2144,7 +2139,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
other_namespaces)
def test_cleanup_namespace_with_registered_router_ids(self):
self.conf.set_override('router_id', None)
stale_namespaces = [namespaces.NS_PREFIX + 'cccc',
namespaces.NS_PREFIX + 'eeeee',
dvr_snat_ns.SNAT_NS_PREFIX + 'fffff']
@ -2156,19 +2150,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
router_list,
other_namespaces)
def test_cleanup_namespace_with_conf_router_id(self):
self.conf.set_override('router_id', 'bbbbb')
stale_namespaces = [namespaces.NS_PREFIX + 'cccc',
namespaces.NS_PREFIX + 'eeeee',
namespaces.NS_PREFIX + self.conf.router_id]
router_list = [{'id': 'foo', 'distributed': False},
{'id': 'aaaa', 'distributed': False}]
other_namespaces = ['qdhcp-aabbcc', 'unknown']
self._cleanup_namespace_test(stale_namespaces,
router_list,
other_namespaces)
def test_create_dvr_gateway(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
router = l3_test_common.prepare_router_data()

View File

@ -55,7 +55,6 @@ class TestDvrRouterOperations(base.BaseTestCase):
agent_config.register_process_monitor_opts(self.conf)
self.conf.register_opts(interface.OPTS)
self.conf.register_opts(external_process.OPTS)
self.conf.set_override('router_id', 'fake_id')
self.conf.set_override('interface_driver',
'neutron.agent.linux.interface.NullDriver')
self.conf.set_override('send_arp_for_ha', 1)

View File

@ -927,23 +927,6 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
self.assertEqual(2, num_hostb_routers)
self.assertEqual(0, num_hosta_routers)
def test_router_auto_schedule_with_candidates(self):
with self.router() as router1, self.router() as router2:
l3_rpc_cb = l3_rpc.L3RpcCallback()
agent = helpers.register_l3_agent(
host=L3_HOSTA, router_id=router1['router']['id'])
l3_rpc_cb.get_router_ids(self.adminContext, host=L3_HOSTA)
hosta_routers = self._list_routers_hosted_by_l3_agent(agent.id)
num_hosta_routers = len(hosta_routers['routers'])
l3_agents_1 = self._list_l3_agents_hosting_router(
router1['router']['id'])
l3_agents_2 = self._list_l3_agents_hosting_router(
router2['router']['id'])
# L3 agent will host only the compatible router.
self.assertEqual(1, num_hosta_routers)
self.assertEqual(1, len(l3_agents_1['agents']))
self.assertEqual(0, len(l3_agents_2['agents']))
def test_rpc_sync_routers(self):
l3_rpc_cb = l3_rpc.L3RpcCallback()
self._register_agent_states()
@ -1017,42 +1000,6 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
# Sync all routers (router3 is scheduled)
_sync_router_with_ids(router_ids, 4, 4, hosta_id)
def test_router_schedule_with_candidates(self):
with self.router() as router1,\
self.router() as router2,\
self.subnet() as subnet1,\
self.subnet(cidr='10.0.3.0/24') as subnet2:
agent = helpers.register_l3_agent(
host=L3_HOSTA, router_id=router1['router']['id'])
self._router_interface_action('add',
router1['router']['id'],
subnet1['subnet']['id'],
None)
self._router_interface_action('add',
router2['router']['id'],
subnet2['subnet']['id'],
None)
hosta_routers = self._list_routers_hosted_by_l3_agent(agent.id)
num_hosta_routers = len(hosta_routers['routers'])
l3_agents_1 = self._list_l3_agents_hosting_router(
router1['router']['id'])
l3_agents_2 = self._list_l3_agents_hosting_router(
router2['router']['id'])
# safe cleanup
self._router_interface_action('remove',
router1['router']['id'],
subnet1['subnet']['id'],
None)
self._router_interface_action('remove',
router2['router']['id'],
subnet2['subnet']['id'],
None)
# L3 agent will host only the compatible router.
self.assertEqual(1, num_hosta_routers)
self.assertEqual(1, len(l3_agents_1['agents']))
self.assertEqual(0, len(l3_agents_2['agents']))
def test_router_without_l3_agents(self):
with self.subnet() as s:
self._set_net_external(s['subnet']['network_id'])

View File

@ -0,0 +1,10 @@
---
prelude: >
Remove 'router_id' configuration option from the
l3_agent.ini file. 'router_id' option has been defined
in order to associate an l3-agent to a specific router
when use_namespaces=False. It was deprecated after
use_namespaces was removed in Mitaka release.
upgrade:
- Remove 'router_id' configuration option from the
l3_agent.ini file.