From: Cedric Brandily Date: Tue, 16 Jun 2015 07:42:35 +0000 (+0200) Subject: Galera multi-writers compliant sync_allocations X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d0820e716f5e86602477bfc2269ecc7af8b4f305;p=openstack-build%2Fneutron-build.git Galera multi-writers compliant sync_allocations 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 --- diff --git a/neutron/plugins/ml2/drivers/type_tunnel.py b/neutron/plugins/ml2/drivers/type_tunnel.py index 054d54680..fec72c84e 100644 --- a/neutron/plugins/ml2/drivers/type_tunnel.py +++ b/neutron/plugins/ml2/drivers/type_tunnel.py @@ -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()