You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initialize the network segment ranges only in first WSGI worker
The implementation done in [1] does not fully work across WSGi workers.
The method ``NetworkSegmentRange.new_default`` tries to first check if
the default segment range for a specific driver (VLAN, tunnelled) is
present. However, as seen in production environments, this method is
not multiprocess safe.
Instead, this patch is limiting the execution of the network segment
ranges initialization to the first WSGI worker (there must be at least
one worker).
This patch also wraps the VLAN and tunnelled drivers initialization
inside a database transaction context. All the operations executed in
this method (register clean-up, new default registers creation and
ranges sync) are done in one single database transaction, that ensures
its isolation and integrity.
NOTE: The same initialization method, when called, removes the
duplicated registers created by [1] in first place. A Neutron API update
and restart will fix the database ``network_segment_ranges`` registers.
NOTE: The ranges class variable (``_TunnelTypeDriverBase.tunnel_ranges``
or ``VlanTypeDriver.network_vlan_ranges``) stores initially the
configured segment ranges (static configuration file). If the network
segment range plugin is loaded, it will store the segment ranges from
the database. But this variable should not be public; instead of this,
the method ``get_network_segment_ranges`` provides the needed class API
to retrieve this information.
[1]https://review.opendev.org/c/openstack/neutron/+/938319
Closes-Bug: #2106463
Change-Id: Ibc42f900214e1f7631e266bccd083a2ef4111585
(cherry picked from commit 39d95a1)
0 commit comments