From e8c37d13eac37210bc34b4ca99e4539c67457120 Mon Sep 17 00:00:00 2001 From: Ripal Nathuji Date: Tue, 18 Sep 2012 09:33:04 -0500 Subject: Fix over rate limit error response Fixes bug 1046021 Changing overLimitFault element in response to overLimit and setting the returned Content-Type appropriately. Also adding retryAfter attribute to provide the same information as the Retry-after header. Change-Id: I8c32fe7075b918afa62da3f84f1d3b35315e2b9b --- nova/api/openstack/wsgi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index f7a013feb..33db3e714 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -1198,10 +1198,11 @@ class OverLimitFault(webob.exc.HTTPException): hdrs = OverLimitFault._retry_after(retry_time) self.wrapped_exc = webob.exc.HTTPRequestEntityTooLarge(headers=hdrs) self.content = { - "overLimitFault": { + "overLimit": { "code": self.wrapped_exc.status_int, "message": message, "details": details, + "retryAfter": hdrs['Retry-After'], }, } @@ -1219,7 +1220,7 @@ class OverLimitFault(webob.exc.HTTPException): error format. """ content_type = request.best_match_content_type() - metadata = {"attributes": {"overLimitFault": "code"}} + metadata = {"attributes": {"overLimit": ["code", "retryAfter"]}} xml_serializer = XMLDictSerializer(metadata, XMLNS_V11) serializer = { @@ -1229,6 +1230,7 @@ class OverLimitFault(webob.exc.HTTPException): content = serializer.serialize(self.content) self.wrapped_exc.body = content + self.wrapped_exc.content_type = content_type return self.wrapped_exc -- cgit