NSXv: Fix before delete notification for shared rotuer

A shared router services are removed from edge when router is left with no
internal interfaces, in that case it should notify subscribers
before the operation is started, this patch fix the wrong condition
assumed for this scenario.

Change-Id: Ia982a9eed4852401757bdb100265e02106aa5475
This commit is contained in:
Roey Chen 2017-05-24 01:32:51 -07:00
parent 699c44ca39
commit b99b129132
1 changed files with 5 additions and 3 deletions

View File

@ -866,7 +866,10 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
network_id = subnet['network_id']
ports = self.plugin._get_router_interface_ports_by_network(
context, router_id, network_id)
if not ports:
connected_networks = (
self.plugin._get_internal_network_ids_by_router(context,
router_id))
if not ports and not connected_networks:
router = self.plugin._get_router(context, router_id)
self._notify_before_router_edge_association(context, router)
with locking.LockManager.get_lock(str(edge_id)):
@ -881,8 +884,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
router_id, network_id)
# unbind all services if no interfaces attached to the
# router
if not self.plugin._get_internal_network_ids_by_router(
context, router_id):
if not connected_networks:
self._remove_router_services_on_edge(context,
router_id)
self._unbind_router_on_edge(context, router_id)