use payloads for SEGMENT AFTER_DELETE events
This patch switches the code over to the payload style of callbacks [1] for SEGMENT AFTER_DELETE events. [1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html Change-Id: Icf5f82c16b4ccbad9baf12750e23375d9910182a
This commit is contained in:
parent
56ac573ddb
commit
374a4a1b92
@ -2002,10 +2002,17 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
return True
|
||||
return False
|
||||
|
||||
@registry.receives(resources.SEGMENT, [events.AFTER_DELETE])
|
||||
def _handle_after_delete_segment_change(
|
||||
self, rtype, event, trigger, payload=None):
|
||||
# TODO(boden); refactor into _handle_segment_change once all
|
||||
# event types use payloads
|
||||
return self._handle_segment_change(
|
||||
rtype, event, trigger, payload.context, payload.latest_state)
|
||||
|
||||
@registry.receives(resources.SEGMENT, (events.PRECOMMIT_CREATE,
|
||||
events.PRECOMMIT_DELETE,
|
||||
events.AFTER_CREATE,
|
||||
events.AFTER_DELETE))
|
||||
events.AFTER_CREATE))
|
||||
def _handle_segment_change(self, rtype, event, trigger, context, segment):
|
||||
if (event == events.PRECOMMIT_CREATE and
|
||||
not isinstance(trigger, segments_plugin.Plugin)):
|
||||
|
@ -203,9 +203,11 @@ class SegmentDbMixin(common_db_mixin.CommonDbMixin):
|
||||
self.delete_segment, context=context,
|
||||
segment=segment_dict)
|
||||
|
||||
registry.notify(resources.SEGMENT, events.AFTER_DELETE,
|
||||
self.delete_segment, context=context,
|
||||
segment=segment_dict)
|
||||
registry.publish(resources.SEGMENT, events.AFTER_DELETE,
|
||||
self.delete_segment,
|
||||
payload=events.DBEventPayload(
|
||||
context, states=(segment_dict,),
|
||||
resource_id=uuid))
|
||||
|
||||
|
||||
@db_api.retry_if_session_inactive()
|
||||
|
Loading…
x
Reference in New Issue
Block a user