]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
quota: synchronize resync and count with other dirty_tenants code
authorIhar Hrachyshka <ihrachys@redhat.com>
Tue, 18 Aug 2015 10:35:15 +0000 (12:35 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Tue, 18 Aug 2015 10:40:42 +0000 (12:40 +0200)
We should synchronize every access or modification of
self._dirty_tenants or self._out_of_sync_tenants.

Closes-Bug: #1485969
Change-Id: If17f57e8905fd8d13438d0421f73468e77f723d9

neutron/quota/resource.py

index 0030307ba694f448ad5f54ebb84b0ade4f94db99..a5f9c039b4de2223cef9bb752d029090819356f3 100644 (file)
@@ -224,6 +224,7 @@ class TrackedResource(BaseResource):
                   {'tenant_id': tenant_id, 'resource': self.name})
         return usage_info
 
+    @lockutils.synchronized('dirty_tenants')
     def resync(self, context, tenant_id):
         if tenant_id not in self._out_of_sync_tenants:
             return
@@ -238,6 +239,7 @@ class TrackedResource(BaseResource):
         # Update quota usage
         return self._resync(context, tenant_id, in_use, reserved)
 
+    @lockutils.synchronized('dirty_tenants')
     def count(self, context, _plugin, tenant_id, resync_usage=False):
         """Return the current usage count for the resource.