From 5a478a3d1817a2a43e6744df3128b463046e6911 Mon Sep 17 00:00:00 2001 From: Boden R Date: Fri, 31 Aug 2018 09:13:29 -0600 Subject: [PATCH] use payloads for ROUTER_INTERFACE BEFORE_DELETE events This patch switches over to the payload style of callbacks by updating neutron to callbacks to handle a DBEventPayload for BEFORE_DELETE events of ROUTER_INTERFACE resources. See the depends on patch for more details. Depends-On: Idd1f43dc7a13b93d9380f49909777e129f1214f2 Change-Id: Ie39dd8cfaed56c79f8dca4ee7438bd0f6c47f32a --- vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py b/vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py index b0dd1d6d0d..805bf381d9 100644 --- a/vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py +++ b/vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py @@ -164,21 +164,22 @@ class EdgeLoadbalancerDriverV2(base_mgr.LoadbalancerBaseManager): resource) raise n_exc.BadRequest(resource='lbaas-lb', msg=msg) - def _check_lb_service_on_router_interface(self, *args, **kwargs): + def _check_lb_service_on_router_interface( + self, resource, event, trigger, payload=None): # Prevent removing the interface of an LB subnet from a router - router_id = kwargs.get('router_id') - subnet_id = kwargs.get('subnet_id') + router_id = payload.resource_id + subnet_id = payload.metadata.get('subnet_id') if not router_id or not subnet_id: return - nsx_router_id = nsx_db.get_nsx_router_id(kwargs['context'].session, - kwargs['router_id']) + nsx_router_id = nsx_db.get_nsx_router_id(payload.context.session, + router_id) if not nsx_router_id: # Skip non-v3 routers (could be a V router in case of TVD plugin) return # get LB ports and check if any loadbalancer is using this subnet - if self._get_lb_ports(kwargs['context'].elevated(), [subnet_id]): + if self._get_lb_ports(payload.context.elevated(), [subnet_id]): msg = _('Cannot delete a router interface as it used by a ' 'loadbalancer') raise n_exc.BadRequest(resource='lbaas-lb', msg=msg)