If a request contains a reference to a nonexistent resource in the
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#section-6.5.4` (section 6.5.4) mentions
the origin server did not find a current representation for the
target resource for 404 and representation for the target resource
means a URI
Nova should return a BadRequest response(400) in this case, because
new_volume_id is specified in a request body. old_volume_id is not
necessary to be changed because the value is specified with URI.
So it is valid to return NotFound response if that is not existent.
Reviewed: https:/ /review. openstack. org/382434 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=ec78fc27f2b 9ea53f533838c91 3fa7e83194df81
Committed: https:/
Submitter: Jenkins
Branch: stable/newton
commit ec78fc27f2b9ea5 3f533838c913fa7 e83194df81
Author: Ken'ichi Ohmichi <email address hidden>
Date: Wed Sep 28 17:41:51 2016 -0700
Fix error status code on update-volume API
As the following part of API-WG guidline[1],
If a request contains a reference to a nonexistent resource in the section- 6.5.4` (section 6.5.4) mentions
body (not URI), the code should be 400 Bad Request. Do not use 404
NotFound because :rfc:`7231#
the origin server did not find a current representation for the
target resource for 404 and representation for the target resource
means a URI
Nova should return a BadRequest response(400) in this case, because
new_volume_id is specified in a request body. old_volume_id is not
necessary to be changed because the value is specified with URI.
So it is valid to return NotFound response if that is not existent.
[1]: https:/ /github. com/openstack/ api-wg/ blob/master/ guidelines/ http.rst# failure- code-clarificat ions
Close-Bug: #1629110 3d64b5880858cc4 f81c3da3977 bc580a7964e7d69 9ee9644b19)
Change-Id: Ib781b116f5af71
(cherry picked from commit edd86d9dac1ea75