update-volume API should return BadRequest response if specified volume with request body is not existent

Bug #1629110 reported by Ken'ichi Ohmichi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Ken'ichi Ohmichi
Newton
In Progress
Medium
Lee Yarwood

Bug Description

As the following part of API-WG guidline[1],

      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 if specified resource with request body is not existent.
However, update-volume API returns a NotFound response instead.
That is a common mistake on REST API and we need to change it to BadRequest.

[1]: https://github.com/openstack/api-wg/blob/master/guidelines/http.rst#failure-code-clarifications

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :
Changed in nova:
assignee: nobody → Ken'ichi Ohmichi (oomichi)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/379044
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=edd86d9dac1ea75bc580a7964e7d699ee9644b19
Submitter: Jenkins
Branch: master

commit edd86d9dac1ea75bc580a7964e7d699ee9644b19
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
      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.

    [1]: https://github.com/openstack/api-wg/blob/master/guidelines/http.rst#failure-code-clarifications

    Close-Bug: #1629110
    Change-Id: Ib781b116f5af713d64b5880858cc4f81c3da3977

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/382434

Matt Riedemann (mriedem)
Changed in nova:
status: In Progress → Fix Released
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/383971

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/382434
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ec78fc27f2b9ea53f533838c913fa7e83194df81
Submitter: Jenkins
Branch: stable/newton

commit ec78fc27f2b9ea53f533838c913fa7e83194df81
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
      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.

    [1]: https://github.com/openstack/api-wg/blob/master/guidelines/http.rst#failure-code-clarifications

    Close-Bug: #1629110
    Change-Id: Ib781b116f5af713d64b5880858cc4f81c3da3977
    (cherry picked from commit edd86d9dac1ea75bc580a7964e7d699ee9644b19)

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/mitaka)

Reviewed: https://review.openstack.org/383971
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4e6958551c324635a8720fc9125e9596860637f7
Submitter: Jenkins
Branch: stable/mitaka

commit 4e6958551c324635a8720fc9125e9596860637f7
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
      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.

    [1]: https://github.com/openstack/api-wg/blob/master/guidelines/http.rst#failure-code-clarifications

    Close-Bug: #1629110
    Change-Id: Ib781b116f5af713d64b5880858cc4f81c3da3977
    (cherry picked from commit edd86d9dac1ea75bc580a7964e7d699ee9644b19)

tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/387644

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/liberty)

Reviewed: https://review.openstack.org/387644
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a967cfe37a3bc26ee8a8517d5f5dac33b35e377e
Submitter: Jenkins
Branch: stable/liberty

commit a967cfe37a3bc26ee8a8517d5f5dac33b35e377e
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
      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.

    [1]: https://github.com/openstack/api-wg/blob/master/guidelines/http.rst#failure-code-clarifications

    Close-Bug: #1629110
    Change-Id: Ib781b116f5af713d64b5880858cc4f81c3da3977
    (cherry picked from commit edd86d9dac1ea75bc580a7964e7d699ee9644b19)
    (cherry picked from commit 4e6958551c324635a8720fc9125e9596860637f7)

tags: added: in-stable-liberty
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.