From b99b129132d01f5f12d985fd9e700ab6282cab4c Mon Sep 17 00:00:00 2001 From: Roey Chen Date: Wed, 24 May 2017 01:32:51 -0700 Subject: [PATCH] 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 --- vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py b/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py index e5ad059ee4..e23d7ab44e 100644 --- a/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py +++ b/vmware_nsx/plugins/nsx_v/drivers/shared_router_driver.py @@ -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)