neutron/neutron/tests/unit/scheduler
Sebastian Lohff b993ebb407 Fix dynamic segment allocation race condition
When two segments are concurrently created this could have resulted in
both threads creating a segment, thus resulting in two segments with
different segmentation ids. To prevent this we now introduce a new
unique constraint onto the networksegments table, which requires
(network_id, network_type, physical_network) to be unique, which allows
only a single segment with a single segmentation id to exist per
combination of these three values.

With the constraint in place a DB error will be thrown, which will cause
allocate_dynamic_segment() to be executed again and this time it will
find the already existing segment. To make sure that no additional DB
objects are created when segment creation failed we need to put all of
the allocation code into a DB transaction.

Change-Id: I407ae88d69ed971bf8d9a9b79120366f33bb56fd
Closes-Bug: #1791233
2021-10-07 13:20:04 +02:00
..
__init__.py Reorganize unit test tree 2015-04-06 23:28:31 +00:00
test_base_scheduler.py L3 agent scheduler should return a valid index if manual scheduling 2020-06-24 15:37:23 +00:00
test_dhcp_agent_scheduler.py Fix dynamic segment allocation race condition 2021-10-07 13:20:04 +02:00
test_l3_agent_scheduler.py use payloads for PORT AFTER_DELETE events 2021-07-11 06:00:08 +00:00
test_l3_ovn_scheduler.py Replace assertItemsEqual with assertCountEqual 2020-11-30 10:21:57 +01:00