Fixes DBDeadlock race condition during driver initialization.

When multiple controllers are initially built, the ml2_vlan_allocations
will be empty and the neutron servers under different controllers will
try to populate the entry at the same time. This will cause this
DBDeadlock error as they try to access the db at the same time.

This patch set is to add db_api.retry_db_error decorator in the
_sync_vlan_allocations method to avoid this race condition.

Change-Id: I7c0e3ae515f592a5852e6decf6820b103f146761
Closes-bug: 1617499
This commit is contained in:
Kahou Lei 2016-08-26 17:43:38 -07:00
parent fa811176e4
commit 55b6c6a63a
1 changed files with 1 additions and 0 deletions

View File

@ -96,6 +96,7 @@ class VlanTypeDriver(helpers.SegmentTypeDriver):
sys.exit(1)
LOG.info(_LI("Network VLAN ranges: %s"), self.network_vlan_ranges)
@db_api.retry_db_errors
def _sync_vlan_allocations(self):
session = db_api.get_session()
with session.begin(subtransactions=True):