From 88a362df09aaf54fd961c41f2175718f184cde0e Mon Sep 17 00:00:00 2001 From: LIU Yulong Date: Fri, 26 Apr 2019 15:42:32 +0800 Subject: [PATCH] Async notify neutron-server for HA states RPC notifier method can sometimes be time-consuming, this will cause other parallel processing resources fail to send notifications in time. This patch changes the notify to asynchronous. Closes-Bug: #1824911 Change-Id: I3f555a0c78fbc02d8214f12b62c37d140bc71da1 (cherry picked from commit 0f471a47c073eb0cf2ed68c30482e1ae71ff6927) --- neutron/agent/l3/agent.py | 2 +- neutron/agent/l3/ha.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/neutron/agent/l3/agent.py b/neutron/agent/l3/agent.py index 103f51eaf36..1cdf315dfdc 100644 --- a/neutron/agent/l3/agent.py +++ b/neutron/agent/l3/agent.py @@ -169,7 +169,7 @@ class L3PluginApi(object): def update_ha_routers_states(self, context, states): """Update HA routers states.""" cctxt = self.client.prepare(version='1.5') - return cctxt.call(context, 'update_ha_routers_states', + return cctxt.cast(context, 'update_ha_routers_states', host=self.host, states=states) def process_prefix_update(self, context, prefix_update): diff --git a/neutron/agent/l3/ha.py b/neutron/agent/l3/ha.py index 899be9b7f00..79587910d23 100644 --- a/neutron/agent/l3/ha.py +++ b/neutron/agent/l3/ha.py @@ -182,6 +182,9 @@ class AgentMixin(object): ri.disable_radvd() def notify_server(self, batched_events): + eventlet.spawn_n(self._notify_server, batched_events) + + def _notify_server(self, batched_events): translated_states = dict((router_id, TRANSLATION_MAP[state]) for router_id, state in batched_events) LOG.debug('Updating server with HA routers states %s',