From 5165320257b18ca1917727c1ae1d3cdde366d85d Mon Sep 17 00:00:00 2001 From: Naveed Massjouni Date: Mon, 9 Jan 2012 21:51:09 +0000 Subject: Adding the request id to response headers. bp:nova-request-response-id Change-Id: Ie2d49337010f6e7a540018f9c8d542b6c8ebbce2 --- nova/api/openstack/wsgi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index bc19a0ae6..7c23d564c 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -438,6 +438,9 @@ class ResponseHeadersSerializer(ActionDispatcher): def serialize(self, response, data, action): self.dispatch(response, data, action=action) + context = response.request.environ.get('nova.context') + if context: + response.headers['X-Compute-Request-Id'] = context.request_id def default(self, response, data): response.status_int = 200 @@ -464,7 +467,7 @@ class ResponseSerializer(object): :param content_type: expected mimetype of serialized response body """ - response = webob.Response() + response = webob.Response(request=request) self.serialize_headers(response, response_data, action) self.serialize_body(request, response, response_data, content_type, action) -- cgit