Use wsgi.response for v2.1 unrescue API

According to the comment on v2.1 unrescue API, v2 unrescue API seems
to return a HTTP200 response on success case. However that is invalid
and it returns a HTTP202 response like the following:

 $ curl -i 'http://nova-api/v2/{tenant-id}/servers/{server-id}/action'
   -X POST -H "Accept: application/json" [..] -d '{"unrescue": null}'
 [..]
 RESP: [202] CaseInsensitiveDict({'date': 'Tue, 21 Oct 2014 02:23:42 GMT',
   'content-length': '0', 'content-type': 'text/html; charset=UTF-8',
   'x-compute-request-id': 'req-642b49e8-0e13-4923-a49b-6c8b317b7b8c'})
 RESP BODY: null

This patch removes the comment and makes the API use wsgi.response for
the code cleanup.

Partially implements blueprint v2-on-v3-api

Change-Id: Ie78e56fafd71f58568a0562b9a452f14d3b19815
This commit is contained in:
Ken'ichi Ohmichi 2014-10-21 02:27:43 +00:00
parent 636534ae11
commit 8d8aee74b1
1 changed files with 1 additions and 6 deletions

View File

@ -15,7 +15,6 @@
"""The rescue mode extension."""
from oslo.config import cfg
import webob
from webob import exc
from nova.api.openstack import common
@ -83,9 +82,7 @@ class RescueController(wsgi.Controller):
else:
return {}
# TODO(cyeoh): Should be responding here with 202 Accept
# because unrescue is an async call, but keep to 200
# for backwards compatibility reasons.
@wsgi.response(202)
@extensions.expected_errors((404, 409, 501))
@wsgi.action('unrescue')
def _unrescue(self, req, id, body):
@ -103,8 +100,6 @@ class RescueController(wsgi.Controller):
'unrescue',
id)
return webob.Response(status_int=202)
class Rescue(extensions.V3APIExtensionBase):
"""Instance rescue mode."""