NSX-V| Fix exclusive router deletion

When MDProxy is enabled, and an exclusive router is being deleted,
the exclusive router driver fails to get the router availability zone
since the neutron router was already deleted.
Instead it should get the AZ name from the router-bindings DB table.

Change-Id: Idb19ac1264d0aa6d6b9ca2b59d487baf81abc341
This commit is contained in:
Adit Sarfaty 2017-04-12 08:12:39 +03:00
parent 1b2bbb3544
commit 395fc69a71

View File

@ -134,8 +134,11 @@ class RouterExclusiveDriver(router_driver.RouterBaseDriver):
def delete_router(self, context, router_id):
if self.plugin.metadata_proxy_handler:
az = self.get_router_az_by_id(context, router_id)
md_proxy = self.plugin.get_metadata_proxy_handler(az.name)
# The neutron router was already deleted, so we cannot get the AZ
# from it. Get it from the router-bindings DB
edge_id, az_name = self.plugin._get_edge_id_and_az_by_rtr_id(
context, router_id)
md_proxy = self.plugin.get_metadata_proxy_handler(az_name)
md_proxy.cleanup_router_edge(context, router_id)
self.edge_manager.delete_lrouter(context, router_id, dist=False)