Revision e20a751d snf-pithos-backend/pithos/backends/modular.py
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
848 | 848 |
|
849 | 849 |
del_size = self._apply_versioning(account, container, pre_version_id) |
850 | 850 |
size_delta = size - del_size |
851 |
if not self.using_external_quotaholder: # Check quota. |
|
851 |
if not self.using_external_quotaholder: # Check account quota.
|
|
852 | 852 |
if size_delta > 0: |
853 | 853 |
account_quota = long(self._get_policy(account_node)['quota']) |
854 | 854 |
account_usage = self._get_statistics(account_node)[1] + size_delta |
855 |
container_quota = long(self._get_policy(container_node)['quota']) |
|
856 |
container_usage = self._get_statistics(container_node)[1] + size_delta |
|
857 | 855 |
if (account_quota > 0 and account_usage > account_quota): |
858 | 856 |
logger.error('account_quota: %s, account_usage: %s' % ( |
859 | 857 |
account_quota, account_usage |
860 | 858 |
)) |
861 | 859 |
raise QuotaError |
862 |
if (container_quota > 0 and container_usage > container_quota): |
|
863 |
# This must be executed in a transaction, so the version is |
|
864 |
# never created if it fails. |
|
865 |
logger.error('container_quota: %s, container_usage: %s' % ( |
|
866 |
container_quota, container_usage |
|
867 |
)) |
|
868 |
raise QuotaError |
|
860 |
|
|
861 |
# Check container quota. |
|
862 |
container_quota = long(self._get_policy(container_node)['quota']) |
|
863 |
container_usage = self._get_statistics(container_node)[1] + size_delta |
|
864 |
if (container_quota > 0 and container_usage > container_quota): |
|
865 |
# This must be executed in a transaction, so the version is |
|
866 |
# never created if it fails. |
|
867 |
logger.error('container_quota: %s, container_usage: %s' % ( |
|
868 |
container_quota, container_usage |
|
869 |
)) |
|
870 |
raise QuotaError |
|
871 |
|
|
869 | 872 |
self._report_size_change(user, account, size_delta, |
870 | 873 |
{'action': 'object update', 'path': path, |
871 | 874 |
'versions': ','.join([str(dest_version_id)])}) |
Also available in: Unified diff