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 da539da378)
This commit is contained in:
Oleg Bondarev 2019-07-10 12:39:13 +04:00
parent 55a503b4c9
commit eabd114a9b
1 changed files with 3 additions and 0 deletions

View File

@ -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
@ -658,6 +659,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: