Merge "allow container create even if over account quota"
This commit is contained in:
commit
022ad52213
@ -95,7 +95,7 @@ class AccountQuotaMiddleware(object):
|
||||
if new_quota is not None:
|
||||
return HTTPForbidden()
|
||||
|
||||
if obj and request.method == "POST":
|
||||
if obj and request.method == "POST" or not obj:
|
||||
return self.app
|
||||
|
||||
copy_from = request.headers.get('X-Copy-From')
|
||||
|
@ -124,6 +124,30 @@ class TestAccountQuota(unittest.TestCase):
|
||||
res = req.get_response(app)
|
||||
self.assertEquals(res.status_int, 413)
|
||||
|
||||
def test_over_quota_container_create_still_works(self):
|
||||
headers = [('x-account-bytes-used', '1001'),
|
||||
('x-account-meta-quota-bytes', '1000')]
|
||||
app = account_quotas.AccountQuotaMiddleware(FakeApp(headers))
|
||||
cache = FakeCache(None)
|
||||
req = Request.blank('/v1/a/new_container',
|
||||
environ={'REQUEST_METHOD': 'PUT',
|
||||
'HTTP_X_CONTAINER_META_BERT': 'ernie',
|
||||
'swift.cache': cache})
|
||||
res = req.get_response(app)
|
||||
self.assertEquals(res.status_int, 200)
|
||||
|
||||
def test_over_quota_container_post_still_works(self):
|
||||
headers = [('x-account-bytes-used', '1001'),
|
||||
('x-account-meta-quota-bytes', '1000')]
|
||||
app = account_quotas.AccountQuotaMiddleware(FakeApp(headers))
|
||||
cache = FakeCache(None)
|
||||
req = Request.blank('/v1/a/new_container',
|
||||
environ={'REQUEST_METHOD': 'POST',
|
||||
'HTTP_X_CONTAINER_META_BERT': 'ernie',
|
||||
'swift.cache': cache})
|
||||
res = req.get_response(app)
|
||||
self.assertEquals(res.status_int, 200)
|
||||
|
||||
def test_over_quota_obj_post_still_works(self):
|
||||
headers = [('x-account-bytes-used', '1001'),
|
||||
('x-account-meta-quota-bytes', '1000')]
|
||||
|
Loading…
Reference in New Issue
Block a user