ML2 VxlanTypeDriver: Synchronize of VxlanAllocation table

At neutron startup VxlanTypeDriver syncs tunnel range from conf
to DB. In case multiple servers deployment restarting several
servers at the same time could lead to DB exceptions being thrown.
Need to synchronize between neutron servers by locking VxlanAllocation
table.

Change-Id: Idf9908f039070b9194612484603f592f1a8d74b8
Closes-Bug: #1307295
This commit is contained in:
Eugene Nikanorov 2014-05-08 15:19:02 +04:00
parent 4e49095156
commit 9df431db73

View File

@ -153,7 +153,7 @@ class VxlanTypeDriver(type_tunnel.TunnelTypeDriver):
session = db_api.get_session()
with session.begin(subtransactions=True):
# remove from table unallocated tunnels not currently allocatable
allocs = session.query(VxlanAllocation)
allocs = session.query(VxlanAllocation).with_lockmode("update")
for alloc in allocs:
try:
# see if tunnel is allocatable