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
This commit is contained in:
parent
07f7c0716b
commit
5a478a3d18
@ -164,21 +164,22 @@ class EdgeLoadbalancerDriverV2(base_mgr.LoadbalancerBaseManager):
|
|||||||
resource)
|
resource)
|
||||||
raise n_exc.BadRequest(resource='lbaas-lb', msg=msg)
|
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
|
# Prevent removing the interface of an LB subnet from a router
|
||||||
router_id = kwargs.get('router_id')
|
router_id = payload.resource_id
|
||||||
subnet_id = kwargs.get('subnet_id')
|
subnet_id = payload.metadata.get('subnet_id')
|
||||||
if not router_id or not subnet_id:
|
if not router_id or not subnet_id:
|
||||||
return
|
return
|
||||||
|
|
||||||
nsx_router_id = nsx_db.get_nsx_router_id(kwargs['context'].session,
|
nsx_router_id = nsx_db.get_nsx_router_id(payload.context.session,
|
||||||
kwargs['router_id'])
|
router_id)
|
||||||
if not nsx_router_id:
|
if not nsx_router_id:
|
||||||
# Skip non-v3 routers (could be a V router in case of TVD plugin)
|
# Skip non-v3 routers (could be a V router in case of TVD plugin)
|
||||||
return
|
return
|
||||||
|
|
||||||
# get LB ports and check if any loadbalancer is using this subnet
|
# 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 '
|
msg = _('Cannot delete a router interface as it used by a '
|
||||||
'loadbalancer')
|
'loadbalancer')
|
||||||
raise n_exc.BadRequest(resource='lbaas-lb', msg=msg)
|
raise n_exc.BadRequest(resource='lbaas-lb', msg=msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user