From ab286bcdaccb788ab9df3186e0605e93a9b10bbc Mon Sep 17 00:00:00 2001 From: Oleg Bondarev Date: Thu, 19 Sep 2019 16:11:06 +0400 Subject: [PATCH] Set DB retry for quota_enforcement pecan_wsgi hook The hook starts a DB transaction and should be covered with DB retry decorator. Closes-Bug: #1777965 Closes-Bug: #1771293 Change-Id: I044980a98845edc7b0a02e3323a1e62eb54c10c7 --- neutron/pecan_wsgi/hooks/quota_enforcement.py | 1 + neutron/quota/resource_registry.py | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/neutron/pecan_wsgi/hooks/quota_enforcement.py b/neutron/pecan_wsgi/hooks/quota_enforcement.py index 29b8b9bac1b..0f42b49ffba 100644 --- a/neutron/pecan_wsgi/hooks/quota_enforcement.py +++ b/neutron/pecan_wsgi/hooks/quota_enforcement.py @@ -61,6 +61,7 @@ class QuotaEnforcementHook(hooks.PecanHook): # retrieved in the 'after' hook state.request.context['reservations'] = reservations + @db_api.retry_db_errors def after(self, state): neutron_context = state.request.context.get('neutron_context') if not neutron_context: diff --git a/neutron/quota/resource_registry.py b/neutron/quota/resource_registry.py index 2637df810eb..05e4832988f 100644 --- a/neutron/quota/resource_registry.py +++ b/neutron/quota/resource_registry.py @@ -61,11 +61,6 @@ def set_resources_dirty(context): dirty status is True, sets the dirty bit to True in the database for the appropriate tenants. - Please note that this routine begins a nested transaction, and it - is not recommended that this transaction begins within another - transaction. For this reason the function will raise a SqlAlchemy - exception if such an attempt is made. - :param context: a Neutron request context with a DB session """ if not cfg.CONF.QUOTAS.track_quota_usage: