]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Galera multi-writers compliant sync_allocations
authorCedric Brandily <zzelle@gmail.com>
Tue, 16 Jun 2015 07:42:35 +0000 (09:42 +0200)
committerCedric Brandily <zzelle@gmail.com>
Wed, 15 Jul 2015 08:24:15 +0000 (08:24 +0000)
Currently sync_allocations[1] uses with_lockmode('update) which implies
possible deadlocks with Galera multi-writers. This change decorates the
method in order to catch and retry sync_allocations.

[1] neutron.plugins.ml2.drivers.type_tunnel

Change-Id: Ic01614cb5daf174848cf14a6aa4b38c4ed40fe1e

neutron/plugins/ml2/drivers/type_tunnel.py

index 054d546801d8934603570645a3006866e6506bec..fec72c84ea965dee6f5e33bfdc572b4ccf93f8e3 100644 (file)
@@ -17,6 +17,7 @@ import itertools
 import operator
 
 from oslo_config import cfg
+from oslo_db import api as oslo_db_api
 from oslo_db import exception as db_exc
 from oslo_log import log
 from six import moves
@@ -122,6 +123,8 @@ class TunnelTypeDriver(helpers.SegmentTypeDriver):
         LOG.info(_LI("%(type)s ID ranges: %(range)s"),
                  {'type': self.get_type(), 'range': current_range})
 
+    @oslo_db_api.wrap_db_retry(
+        max_retries=db_api.MAX_RETRIES, retry_on_deadlock=True)
     def sync_allocations(self):
         # determine current configured allocatable tunnel ids
         tunnel_ids = set()