Merge "use publish for SEGMENT_HOST_MAPPING callback events"
This commit is contained in:
commit
92215d40cb
@ -299,9 +299,12 @@ def _update_segment_host_mapping_for_agent(resource, event, trigger,
|
|||||||
segment['id'] for segment in segments
|
segment['id'] for segment in segments
|
||||||
if check_segment_for_agent(segment, agent)}
|
if check_segment_for_agent(segment, agent)}
|
||||||
update_segment_host_mapping(context, host, current_segment_ids)
|
update_segment_host_mapping(context, host, current_segment_ids)
|
||||||
registry.notify(resources.SEGMENT_HOST_MAPPING, events.AFTER_CREATE,
|
registry.publish(resources.SEGMENT_HOST_MAPPING, events.AFTER_CREATE,
|
||||||
plugin, context=context, host=host,
|
plugin, payload=events.DBEventPayload(
|
||||||
current_segment_ids=current_segment_ids)
|
context,
|
||||||
|
metadata={
|
||||||
|
'host': host,
|
||||||
|
'current_segment_ids': current_segment_ids}))
|
||||||
|
|
||||||
|
|
||||||
def _add_segment_host_mapping_for_segment(resource, event, trigger,
|
def _add_segment_host_mapping_for_segment(resource, event, trigger,
|
||||||
|
@ -348,13 +348,14 @@ class NovaSegmentNotifier(object):
|
|||||||
|
|
||||||
@registry.receives(resources.SEGMENT_HOST_MAPPING, [events.AFTER_CREATE])
|
@registry.receives(resources.SEGMENT_HOST_MAPPING, [events.AFTER_CREATE])
|
||||||
def _notify_host_addition_to_aggregate(self, resource, event, trigger,
|
def _notify_host_addition_to_aggregate(self, resource, event, trigger,
|
||||||
context, host, current_segment_ids,
|
payload=None):
|
||||||
**kwargs):
|
subnets = subnet_obj.Subnet.get_objects(
|
||||||
subnets = subnet_obj.Subnet.get_objects(context,
|
payload.context,
|
||||||
segment_id=current_segment_ids)
|
segment_id=payload.metadata.get('current_segment_ids'))
|
||||||
segment_ids = {s.segment_id for s in subnets}
|
segment_ids = {s.segment_id for s in subnets}
|
||||||
self.batch_notifier.queue_event(Event(self._add_host_to_aggregate,
|
self.batch_notifier.queue_event(
|
||||||
segment_ids, host=host))
|
Event(self._add_host_to_aggregate,
|
||||||
|
segment_ids, host=payload.metadata.get('host')))
|
||||||
|
|
||||||
def _add_host_to_aggregate(self, event):
|
def _add_host_to_aggregate(self, event):
|
||||||
for segment_id in event.segment_ids:
|
for segment_id in event.segment_ids:
|
||||||
|
Loading…
Reference in New Issue
Block a user