Don't update metadata_proxy if metadata is not enabled
When enable_metadata_proxy is false, the agent instance will not have metadata_driver. And agent should avoid using it. Change-Id: Ia18dc5dea23de49b97c8f225532531eb9232fb51 Closes-Bug: #1510399
This commit is contained in:
parent
5e34292faa
commit
ce3a31faff
neutron
@ -123,7 +123,8 @@ class AgentMixin(object):
|
||||
return
|
||||
|
||||
self._configure_ipv6_ra_on_ext_gw_port_if_necessary(ri, state)
|
||||
self._update_metadata_proxy(ri, router_id, state)
|
||||
if self.conf.enable_metadata_proxy:
|
||||
self._update_metadata_proxy(ri, router_id, state)
|
||||
self._update_radvd_daemon(ri, state)
|
||||
self.state_change_notifier.queue_event((router_id, state))
|
||||
|
||||
|
@ -185,6 +185,16 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
||||
# Make sure the exceptional code path has coverage
|
||||
agent.enqueue_state_change(non_existent_router, 'master')
|
||||
|
||||
def test_enqueue_state_change_metadata_disable(self):
|
||||
self.conf.set_override('enable_metadata_proxy', False)
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
router = mock.Mock()
|
||||
router_info = mock.MagicMock()
|
||||
agent.router_info[router.id] = router_info
|
||||
agent._update_metadata_proxy = mock.Mock()
|
||||
agent.enqueue_state_change(router.id, 'master')
|
||||
self.assertFalse(agent._update_metadata_proxy.call_count)
|
||||
|
||||
def test_periodic_sync_routers_task_raise_exception(self):
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
self.plugin_api.get_routers.side_effect = ValueError
|
||||
|
Loading…
x
Reference in New Issue
Block a user