Fix l3-agent usage of L3AgentExtension class
The L3AgentExtension class delete_router() method expects a dict as it's 'data' argument, but the l3-agent code that deletes a router was passing just the router ID. Change to correctly pass a router dictionary if one exists. Change-Id: I112d1f8dce9defddfbd8fbfa75bf538e308e1561 Closes-bug: #1809134
This commit is contained in:
parent
284afcf24f
commit
4bb78e8c21
|
@ -392,18 +392,20 @@ class L3NATAgent(ha.AgentMixin,
|
|||
|
||||
def _safe_router_removed(self, router_id):
|
||||
"""Try to delete a router and return True if successful."""
|
||||
# The l3_ext_manager API expects a router dict, look it up
|
||||
ri = self.router_info.get(router_id)
|
||||
|
||||
try:
|
||||
self._router_removed(router_id)
|
||||
self.l3_ext_manager.delete_router(self.context, router_id)
|
||||
self._router_removed(ri, router_id)
|
||||
if ri:
|
||||
self.l3_ext_manager.delete_router(self.context, ri.router)
|
||||
except Exception:
|
||||
LOG.exception('Error while deleting router %s', router_id)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def _router_removed(self, router_id):
|
||||
ri = self.router_info.get(router_id)
|
||||
def _router_removed(self, ri, router_id):
|
||||
if ri is None:
|
||||
LOG.warning("Info for router %s was not found. "
|
||||
"Performing router cleanup", router_id)
|
||||
|
|
|
@ -359,7 +359,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
|||
return agent.router_info[router['id']]
|
||||
|
||||
def _delete_router(self, agent, router_id):
|
||||
agent._router_removed(router_id)
|
||||
agent._safe_router_removed(router_id)
|
||||
|
||||
def _add_fip(self, router, fip_address, fixed_address='10.0.0.2',
|
||||
host=None, fixed_ip_address_scope=None):
|
||||
|
|
|
@ -2450,7 +2450,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||
)
|
||||
else:
|
||||
self.assertFalse(spawn_proxy.call_count)
|
||||
agent._router_removed(router_id)
|
||||
agent._safe_router_removed(router_id)
|
||||
if enableflag:
|
||||
destroy_proxy.assert_called_with(mock.ANY,
|
||||
router_id,
|
||||
|
|
Loading…
Reference in New Issue