diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-09-11 05:48:14 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-09-11 05:48:14 +0000 |
commit | 85e30694dad85b8e6e4a0cd1e23b10dd375fe858 (patch) | |
tree | 2abfe069e76b9cbd7e19ca546fbf4facce4eacf6 /neutron/pecan_wsgi | |
parent | a34c26b916542c90bc51607f01274b35b905d1ce (diff) | |
parent | e76a575b0570880d4209ff1ea73f82c01e4a6e24 (diff) | |
download | neutron-85e30694dad85b8e6e4a0cd1e23b10dd375fe858.tar.gz |
Merge "Pecan: add calls to resync/dirty quota usages"
Diffstat (limited to 'neutron/pecan_wsgi')
-rw-r--r-- | neutron/pecan_wsgi/hooks/quota_enforcement.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/neutron/pecan_wsgi/hooks/quota_enforcement.py b/neutron/pecan_wsgi/hooks/quota_enforcement.py index 042561700f..f781c88fa1 100644 --- a/neutron/pecan_wsgi/hooks/quota_enforcement.py +++ b/neutron/pecan_wsgi/hooks/quota_enforcement.py @@ -62,11 +62,19 @@ class QuotaEnforcementHook(hooks.PecanHook): state.request.context['reservations'] = reservations def after(self, state): + neutron_context = state.request.context.get('neutron_context') + if not neutron_context: + return + collection = state.request.context.get('collection') + resource = state.request.context.get('resource') + if state.request.method == 'GET' and collection: + # resync on list operations to preserve behavior of old API + resource_registry.resync_resource( + neutron_context, resource, neutron_context.tenant_id) # Commit reservation(s) - reservations = state.request.context.get('reservations') - if not reservations: + reservations = state.request.context.get('reservations') or [] + if not reservations and state.request.method != 'DELETE': return - neutron_context = state.request.context.get('neutron_context') with db_api.context_manager.writer.using(neutron_context): # Commit the reservation(s) for reservation in reservations: |