From: Eugene Nikanorov Date: Thu, 8 May 2014 11:19:02 +0000 (+0400) Subject: ML2 VxlanTypeDriver: Synchronize of VxlanAllocation table X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b3e52b6b2462cf80dbdb5fa4785e51b0d147316e;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/plugins/ml2/drivers/type_vxlan.py b/neutron/plugins/ml2/drivers/type_vxlan.py index 959300d30..0764be310 100644 --- a/neutron/plugins/ml2/drivers/type_vxlan.py +++ b/neutron/plugins/ml2/drivers/type_vxlan.py @@ -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