From 8bd5ecd4fc0c7c6199983c710c62b1ad88039a4f Mon Sep 17 00:00:00 2001 From: Bence Romsics Date: Fri, 27 Jul 2018 14:19:58 +0200 Subject: [PATCH] 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) --- neutron/db/agents_db.py | 2 +- neutron/services/segments/db.py | 3 ++- ...tification-signature-status-6a9b9dbce9cb9740.yaml | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/agent-notification-signature-status-6a9b9dbce9cb9740.yaml diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index ad184df3d0d..309f24ec50d 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -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): diff --git a/neutron/services/segments/db.py b/neutron/services/segments/db.py index 9013bde8344..93885532b31 100644 --- a/neutron/services/segments/db.py +++ b/neutron/services/segments/db.py @@ -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 diff --git a/releasenotes/notes/agent-notification-signature-status-6a9b9dbce9cb9740.yaml b/releasenotes/notes/agent-notification-signature-status-6a9b9dbce9cb9740.yaml new file mode 100644 index 00000000000..29059b0694f --- /dev/null +++ b/releasenotes/notes/agent-notification-signature-status-6a9b9dbce9cb9740.yaml @@ -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.