raise ItemNotFound('Container does not exist')
except ValueError:
raise BadRequest('Invalid sharing header')
- except QuotaError:
- raise RequestEntityTooLarge('Quota exceeded')
+ except QuotaError, e:
+ raise RequestEntityTooLarge('Quota exceeded: %s' % e)
if not checksum and UPDATE_MD5:
# Update the MD5 after the hashmap, as there may be missing hashes.
checksum = hashmap_md5(request.backend, hashmap, size)
raise Forbidden('Not allowed')
except ItemNotExists:
raise ItemNotFound('Container does not exist')
- except QuotaError:
- raise RequestEntityTooLarge('Quota exceeded')
+ except QuotaError, e:
+ raise RequestEntityTooLarge('Quota exceeded: %s' % e)
response = HttpResponse(status=201)
response['ETag'] = checksum
raise ItemNotFound('Container does not exist')
except ValueError:
raise BadRequest('Invalid sharing header')
- except QuotaError:
- raise RequestEntityTooLarge('Quota exceeded')
+ except QuotaError, e:
+ raise RequestEntityTooLarge('Quota exceeded %s:' % e)
if public is not None:
try:
request.backend.update_object_public(request.user_uniq, v_account,
logger = logging.getLogger(__name__)
+
def backend_method(func=None, autocommit=1):
if func is None:
def fn(func):
del_size = self._apply_versioning(account, container, pre_version_id)
size_delta = size - del_size
if size_delta > 0:
+ #check account quota
account_quota = long(self._get_policy(account_node)['quota'])
+ account_usage = self._get_statistics(account_node)[1]
+ if (account_quota > 0 and account_usage + size_delta > account_quota):
+ msg = """account_quota:%d, account_usage:%d, size:%d,
+ del_size:%d, pre_version_id:%d""" % (account_quota,
+ account_usage,
+ size, del_size,
+ pre_version_id)
+ # This must be executed in a transaction, so the version is never created if it fails.
+ raise QuotaError(msg)
+
+ #check container quota
container_quota = long(self._get_policy(container_node)['quota'])
- if (account_quota > 0 and self._get_statistics(account_node)[1] + size_delta > account_quota) or \
- (container_quota > 0 and self._get_statistics(container_node)[1] + size_delta > container_quota):
+ container_usage = self._get_statistics(container_node)[1]
+ if (container_quota > 0 and container_usage + size_delta > container_quota):
+ msg = """container_quota:%d, container_usage:%d, size:%d,
+ del_size:%d, pre_version_id:%d""" % (container_quota,
+ container_usage,
+ size, del_size,
+ pre_version_id)
# This must be executed in a transaction, so the version is never created if it fails.
- raise QuotaError
+ raise QuotaError(msg)
self._report_size_change(user, account, size_delta, {'action': 'object update', 'path':path})
if permissions is not None: