diff --git a/neutron/services/segments/db.py b/neutron/services/segments/db.py index 88fe78dc0b0..a8f1436b461 100644 --- a/neutron/services/segments/db.py +++ b/neutron/services/segments/db.py @@ -299,9 +299,12 @@ def _update_segment_host_mapping_for_agent(resource, event, trigger, segment['id'] for segment in segments if check_segment_for_agent(segment, agent)} update_segment_host_mapping(context, host, current_segment_ids) - registry.notify(resources.SEGMENT_HOST_MAPPING, events.AFTER_CREATE, - plugin, context=context, host=host, - current_segment_ids=current_segment_ids) + registry.publish(resources.SEGMENT_HOST_MAPPING, events.AFTER_CREATE, + plugin, payload=events.DBEventPayload( + context, + metadata={ + 'host': host, + 'current_segment_ids': current_segment_ids})) def _add_segment_host_mapping_for_segment(resource, event, trigger, diff --git a/neutron/services/segments/plugin.py b/neutron/services/segments/plugin.py index b607f09e6b4..cc08c22af8c 100644 --- a/neutron/services/segments/plugin.py +++ b/neutron/services/segments/plugin.py @@ -348,13 +348,14 @@ class NovaSegmentNotifier(object): @registry.receives(resources.SEGMENT_HOST_MAPPING, [events.AFTER_CREATE]) def _notify_host_addition_to_aggregate(self, resource, event, trigger, - context, host, current_segment_ids, - **kwargs): - subnets = subnet_obj.Subnet.get_objects(context, - segment_id=current_segment_ids) + payload=None): + subnets = subnet_obj.Subnet.get_objects( + payload.context, + segment_id=payload.metadata.get('current_segment_ids')) segment_ids = {s.segment_id for s in subnets} - self.batch_notifier.queue_event(Event(self._add_host_to_aggregate, - segment_ids, host=host)) + self.batch_notifier.queue_event( + Event(self._add_host_to_aggregate, + segment_ids, host=payload.metadata.get('host'))) def _add_host_to_aggregate(self, event): for segment_id in event.segment_ids: