]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ML2 VxlanTypeDriver: Synchronize of VxlanAllocation table
authorEugene Nikanorov <enikanorov@mirantis.com>
Thu, 8 May 2014 11:19:02 +0000 (15:19 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Thu, 8 May 2014 11:19:02 +0000 (15:19 +0400)
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

neutron/plugins/ml2/drivers/type_vxlan.py

index 959300d30c78a936846510a90318da12f9fd70d4..0764be31071a6c615577d63c6b55d5ea70ee0783 100644 (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