neutron/releasenotes/notes/add-networksegments-uniq-constraint-89e52b42ca2f7ec2.yaml
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

9 lines
394 B
YAML

---
upgrade:
- |
A unique constraint for (network_id, network_type, physical_network) is
added to the networksegments table. This was done to prevent race
conditions on dynamic segment allocation. Operators having networks with
multiple segments (e.g. when using hierarchical portbinding) should check
that this constraint is not violated with the included upgrade-check.