From 20e3f25cf76e48bc6106fba7eb5cafe9cf35fdbc Mon Sep 17 00:00:00 2001 From: Oleg Bondarev Date: Wed, 10 Jul 2019 12:39:13 +0400 Subject: [PATCH] Yield control to other greenthreads while processing trusted ports process_trusted_ports() appeared to be greenthread unfriendly, so if there are many trusted ports on a node, openvswitch agent may "hang" for a significant time. This patch adds explicit yield. Change-Id: I7c00812f877e2fc966bbac3060e1187ce1b809ca Closes-Bug: #1836023 (cherry picked from commit da539da3780188f01e18ef106dde9ca180324c2a) --- neutron/agent/linux/openvswitch_firewall/firewall.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neutron/agent/linux/openvswitch_firewall/firewall.py b/neutron/agent/linux/openvswitch_firewall/firewall.py index 36dcc5efd6c..b4238a405cc 100644 --- a/neutron/agent/linux/openvswitch_firewall/firewall.py +++ b/neutron/agent/linux/openvswitch_firewall/firewall.py @@ -17,6 +17,7 @@ import collections import contextlib import copy +import eventlet import netaddr from neutron_lib.callbacks import events as callbacks_events from neutron_lib.callbacks import registry as callbacks_registry @@ -664,6 +665,8 @@ class OVSFirewallDriver(firewall.FirewallDriver): """Pass packets from these ports directly to ingress pipeline.""" for port_id in port_ids: self._initialize_egress_no_port_security(port_id) + # yield to let other greenthreads proceed + eventlet.sleep(0) def remove_trusted_ports(self, port_ids): for port_id in port_ids: