neutron/neutron
Rodolfo Alonso Hernandez 2d849c6fee Refactor the L3 agent batch notifier
This patch is the first one of a series of patches improving how the L3
agents update the router HA state to the Neutron server.

This patch partially reverts the previous patch [1]. When the batch
notifier sends events, it calls the callback method passed during the
initialization, in this case AgentMixin.notify_server. The batch
notifier spawns a new thread in charge of sending the notifications and
then wait the specified "batch_interval" time. If the callback method is
not synchronous with the notify thread execution (what [1] implemented),
the thread can finish while the RPC client is still sending the
HA router states. If another HA state update is received, then both
updates can be executed at the same time. It is possible then that a new
router state can be overwritten with an old one still not sent or
processed.

The batch notifier is refactored, to improve what initally was
implemented [2] and then updated [3]. Currently, each new event thread
can update the "pending_events" list. Then, a new thread is spawned to
process this event list. This thread decouples the current execution
from the calling thread, making the event processing a non-blocking
process.

But with the current implementation, each new process will spawn a new
thread, synchronized with the previous and new ones (using a
synchronized decorator). That means, during the batch interval time, the
system can have as many threads waiting as new events received. Those
threads will end secuentially when the previous threads end the batch
interval sleep time.

Instead of this, this patch receives and enqueue each new event and
allows only one thread to be alive while processing the event list. If
at the end of the processing loop new events are stored, the thread will
process then.

[1] I3f555a0c78fbc02d8214f12b62c37d140bc71da1
[2] I2f8cf261f48bdb632ac0bd643a337290b5297fce
[3] I82f403441564955345f47877151e0c457712dd2f

Partial-Bug: #1837635

Change-Id: I20cfa1cf5281198079f5e0dbf195755abc919581
(cherry picked from commit 8b7d2c8a93)
2020-04-10 16:39:30 +02:00
..
agent Refactor the L3 agent batch notifier 2020-04-10 16:39:30 +02:00
api Merge "Fix bug: AttributeError arises while sorting with standard attributes" into stable/rocky 2020-02-26 14:08:37 +00:00
cmd Secure dnsmasq process against external abuse 2019-02-01 09:07:14 +00:00
common Merge "Trigger router update only when gateway port IP changed" into stable/rocky 2020-02-24 19:04:21 +00:00
conf Add accepted egress direct flow 2020-03-26 08:23:32 +00:00
core_extensions Refactor duplicated implementation of _get_policy_obj 2018-06-20 09:51:02 +08:00
db Ensure that default SG exists during list of SG rules API call 2020-03-03 09:09:29 +00:00
debug Fix all pep8 E265 errors 2018-04-30 16:35:52 -04:00
extensions Fix resource schemas and releated `get_sorts` test cases 2020-02-15 12:31:31 +01:00
hacking use sqla functions from neutron-lib 2018-07-25 21:04:20 +00:00
ipam Add bulk IP address assignment to ipam driver 2020-03-26 12:30:50 +00:00
locale Imported Translations from Zanata 2018-11-30 09:16:33 +00:00
notifiers Refactor the L3 agent batch notifier 2020-04-10 16:39:30 +02:00
objects Handle ports assigned to routers without routerports 2019-10-15 10:44:54 +00:00
pecan_wsgi Set DB retry for quota_enforcement pecan_wsgi hook 2019-12-09 12:08:47 +00:00
plugins Add accepted egress direct flow 2020-03-26 08:23:32 +00:00
privileged Check the namespace is ready in test_mtu_update tests 2019-09-16 09:30:43 +00:00
quota Set DB retry for quota_enforcement pecan_wsgi hook 2019-12-09 12:08:47 +00:00
scheduler Fetch specific columns rather than full ORM entities 2018-09-27 16:28:37 +00:00
server Re-use existing ProcessLauncher from wsgi in RPC workers 2020-02-19 07:59:06 +00:00
services Merge "Ensure driver error preventing trunk port deletion is logged" into stable/rocky 2020-02-19 19:05:02 +00:00
tests Refactor the L3 agent batch notifier 2020-04-10 16:39:30 +02:00
__init__.py
_i18n.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
auth.py Use oslo.context class method to construct context object 2017-03-23 09:02:46 +00:00
manager.py Avoid loading same service plugin more than once 2019-04-12 08:33:38 +00:00
neutron_plugin_base_v2.py Do not load default service plugins if core plugin is not DB based 2017-11-09 20:34:52 +00:00
opts.py Merge "Remove deprecated cache_url" 2018-01-03 06:35:59 +00:00
policy.py List SG rules which belongs to tenant's SG 2020-01-29 08:04:16 +00:00
service.py Re-use existing ProcessLauncher from wsgi in RPC workers 2020-02-19 07:59:06 +00:00
version.py
worker.py replace WorkerSupportServiceMixin with neutron-lib's WorkerBase 2017-06-14 06:56:48 -06:00
wsgi.py Re-use existing ProcessLauncher from wsgi in RPC workers 2020-02-19 07:59:06 +00:00