Merge "Logging a policy index when container PUT request conflicts"

This commit is contained in:
Jenkins 2015-02-13 01:50:53 +00:00 committed by Gerrit Code Review
commit 923e17b2b8
2 changed files with 6 additions and 1 deletions

View File

@ -308,7 +308,9 @@ class ContainerController(BaseStorageServer):
elif requested_policy_index is not None:
# validate requested policy with existing container
if requested_policy_index != broker.storage_policy_index:
raise HTTPConflict(request=req)
raise HTTPConflict(request=req,
headers={'x-backend-storage-policy-index':
broker.storage_policy_index})
broker.update_put_timestamp(timestamp)
if broker.is_deleted():
raise HTTPConflict(request=req)

View File

@ -476,6 +476,9 @@ class TestContainerController(unittest.TestCase):
})
resp = req.get_response(self.controller)
self.assertEquals(resp.status_int, 409)
self.assertEquals(
resp.headers.get('X-Backend-Storage-Policy-Index'),
str(policy.idx))
# and make sure there is no change!
req = Request.blank('/sda1/p/a/c')