Merge "use payloads for SUBNET BEFORE_DELETE events"
This commit is contained in:
commit
83dffac498
@ -79,9 +79,9 @@ AUTO_DELETE_PORT_OWNERS = [constants.DEVICE_OWNER_DHCP]
|
|||||||
|
|
||||||
def _check_subnet_not_used(context, subnet_id):
|
def _check_subnet_not_used(context, subnet_id):
|
||||||
try:
|
try:
|
||||||
kwargs = {'context': context, 'subnet_id': subnet_id}
|
registry.publish(
|
||||||
registry.notify(
|
resources.SUBNET, events.BEFORE_DELETE, None,
|
||||||
resources.SUBNET, events.BEFORE_DELETE, None, **kwargs)
|
payload=events.DBEventPayload(context, resource_id=subnet_id))
|
||||||
except exceptions.CallbackFailure as e:
|
except exceptions.CallbackFailure as e:
|
||||||
raise exc.SubnetInUse(subnet_id=subnet_id, reason=e)
|
raise exc.SubnetInUse(subnet_id=subnet_id, reason=e)
|
||||||
|
|
||||||
|
@ -5499,13 +5499,13 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
|
|||||||
|
|
||||||
def test_delete_subnet_with_callback(self):
|
def test_delete_subnet_with_callback(self):
|
||||||
with self.subnet() as subnet,\
|
with self.subnet() as subnet,\
|
||||||
mock.patch.object(registry, 'notify') as notify:
|
mock.patch.object(registry, 'publish') as publish:
|
||||||
|
|
||||||
errors = [
|
errors = [
|
||||||
exceptions.NotificationError(
|
exceptions.NotificationError(
|
||||||
'fake_id', lib_exc.NeutronException()),
|
'fake_id', lib_exc.NeutronException()),
|
||||||
]
|
]
|
||||||
notify.side_effect = [
|
publish.side_effect = [
|
||||||
exceptions.CallbackFailure(errors=errors), None
|
exceptions.CallbackFailure(errors=errors), None
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user