notification: Add 'status' to agent after_create/update

Make the same status information available to notification consumers
(resource==agent, event==after_create/after_update) as it was already
available where the notification is sent in class AgentDbMixin.

Change-Id: Ie74091da934c7e49fd29ae4c6f930a7eb47e14b2
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
This commit is contained in:
Bence Romsics 2018-07-27 14:19:58 +02:00
parent b5fbac8ec8
commit 8bd5ecd4fc
3 changed files with 15 additions and 2 deletions

View File

@ -425,7 +425,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
agent_state['admin_state_up'] = agent.admin_state_up
registry.notify(resources.AGENT, event_type, self, context=context,
host=agent_state['host'], plugin=self,
agent=agent_state)
agent=agent_state, status=status)
return status, agent_state
def _get_agents_considered_for_versions(self):

View File

@ -252,7 +252,8 @@ def map_segment_to_hosts(context, segment_id, hosts):
def _update_segment_host_mapping_for_agent(resource, event, trigger,
context, host, plugin, agent):
context, host, plugin, agent,
status):
check_segment_for_agent = getattr(plugin, 'check_segment_for_agent', None)
if not check_segment_for_agent:
return

View File

@ -0,0 +1,12 @@
---
deprecations:
- |
The signature of notifications for resource ``agent`` for events
``after_create`` and ``after_update`` was extended. A new keyword
argument was added: ``status``. This is to make the same status
information available to notification consumers as it was available
already where the notification is sent in class ``AgentDbMixin``.
Valid status values are defined in ``neutron_lib.agent.constants``.
Consuming notifications by the old signature is deprecated. Unless
processing arguments as ``**kwargs``, out-of-tree notification
consumers need to adapt.