use payloads for SECURITY_GROUP BEFORE_CREATE events

This patch switches the code over to the payload style of callbacks [1]
for SECURITY_GROUP BEFORE_CREATE events.

Depends-On: Id48d1d0ec429011310571a7b43ffbb4a6d9f1610

[1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html

Change-Id: I061aa6f8cffb1ae6bfe2dab4e19fce7f080d2f6e
This commit is contained in:
Boden R 2019-01-03 14:42:35 -07:00
parent 71ff7272f4
commit 922a62d39b

View File

@ -91,7 +91,12 @@ class ExtendedSecurityGroupPropertiesMixin(object):
}
self._registry_notify(resources.SECURITY_GROUP, events.BEFORE_CREATE,
exc_cls=ext_sg.SecurityGroupConflict, **kwargs)
exc_cls=ext_sg.SecurityGroupConflict,
payload=events.DBEventPayload(
context, metadata={'is_default': default_sg},
request_body=security_group,
desired_state=s))
tenant_id = s['tenant_id']
if not default_sg: