Revision d3655326
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
825 | 825 |
|
826 | 826 |
del_size = self._apply_versioning(account, container, pre_version_id) |
827 | 827 |
size_delta = size - del_size |
828 |
if not quotaholder_url: # Check quota. |
|
829 |
if size_delta > 0: |
|
830 |
account_quota = long(self._get_policy(account_node)['quota']) |
|
831 |
container_quota = long(self._get_policy(container_node)['quota']) |
|
832 |
if (account_quota > 0 and self._get_statistics(account_node)[1] + size_delta > account_quota) or \ |
|
833 |
(container_quota > 0 and self._get_statistics(container_node)[1] + size_delta > container_quota): |
|
834 |
# This must be executed in a transaction, so the version is never created if it fails. |
|
835 |
raise QuotaError |
|
828 |
if not self.quotaholder_url: # Check quota. |
|
829 |
if size_delta > 0: |
|
830 |
account_quota = long(self._get_policy(account_node)['quota']) |
|
831 |
account_usage = self._get_statistics(account_node)[1] + size_delta |
|
832 |
container_quota = long(self._get_policy(container_node)['quota']) |
|
833 |
container_usage = self._get_statistics(container_node)[1] + size_delta |
|
834 |
if (account_quota > 0 and account_usage > account_quota): |
|
835 |
logger.error('account_quota: %s, account_usage: %s' % ( |
|
836 |
account_quota, account_usage |
|
837 |
)) |
|
838 |
raise QuotaError |
|
839 |
if (container_quota > 0 and container_usage > container_quota): |
|
840 |
# This must be executed in a transaction, so the version is |
|
841 |
# never created if it fails. |
|
842 |
logger.error('container_quota: %s, container_usage: %s' % ( |
|
843 |
container_quota, container_usage |
|
844 |
)) |
|
845 |
raise QuotaError |
|
836 | 846 |
self._report_size_change(user, account, size_delta, |
837 | 847 |
{'action': 'object update', 'path': path, |
838 | 848 |
'versions': ','.join([str(dest_version_id)])}) |
Also available in: Unified diff