]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Don't crash when adding duplicate gre allocation
authorJakub Libosvar <libosvar@redhat.com>
Tue, 3 Feb 2015 13:33:39 +0000 (14:33 +0100)
committerJakub Libosvar <libosvar@redhat.com>
Mon, 9 Feb 2015 23:10:25 +0000 (00:10 +0100)
commit50b469fae2dbd1517d856509f37328394e0697e4
tree32909c61fe860ecfa7e2c3a463ecc3cf22c395c9
parent596db61cf98c50d4661c061f1437cfce3796d61b
Don't crash when adding duplicate gre allocation

This patch catches DBDuplicateError when initializing ML2 GRE type
driver and allocation already exists in DB. Because current allocations
are queried and then only those that doesn't exist in database are
added, DBDuplicateError should never occur.

But the race can happen when running multiple neutron-servers and one
of servers adds allocations between allocations are queried and added.

Change-Id: I427b7020d61b0d2c06292ff2804ba1f4483696c6
Closes-bug: 1417560
neutron/plugins/ml2/drivers/type_gre.py
neutron/tests/unit/ml2/test_type_gre.py