Volume creation 201 API response does not include a Location header

Bug #1026600 reported by Mark McLoughlin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Eoghan Glynn

Bug Description

(This is with commit 5f45ead of nova, which is the master branch some time post folsom-2)

When creating a volume, the response is a 200 OK not a 201 Created

201 Created seems to make sense and would be nice because it would include a Location header

$> nova --debug volume-create 1
...
connect: (192.168.122.209, 8776)
send: u'POST /v1/4f54f86f521444039476b818b34a789c/volumes HTTP/1.1\r\nHost: 192.168.122.209:8776\r\nContent-Length: 116\r\nx-auth-project-id: demo\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nx-auth-token: 13e8e74022ee45949b036df5d53d9c04\r\nuser-agent: python-novaclient\r\ncontent-type: application/json\r\n\r\n{"volume": {"snapshot_id": null, "display_name": null, "volume_type": null, "display_description": null, "size": 1}}'
reply: 'HTTP/1.1 200 OK\r\n'
header: X-Compute-Request-Id: req-431012af-0694-4e5d-a2bc-4f68125bd028
header: Content-Type: application/json
header: Content-Length: 294
header: Date: Thu, 19 Jul 2012 12:52:30 GMT

REQ: curl -i http://192.168.122.209:8776/v1/4f54f86f521444039476b818b34a789c/volumes -X POST -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 13e8e74022ee45949b036df5d53d9c04"

REQ BODY: {"volume": {"snapshot_id": null, "display_name": null, "volume_type": null, "display_description": null, "size": 1}}

RESP:{'date': 'Thu, 19 Jul 2012 12:52:30 GMT', 'status': '200', 'x-compute-request-id': 'req-431012af-0694-4e5d-a2bc-4f68125bd028', 'content-type': 'application/json', 'content-length': '294'} {"volume": {"status": "creating", "display_name": null, "attachments": [], "availability_zone": "nova", "created_at": "2012-07-19T12:52:30.708108", "display_description": null, "volume_type": "None", "snapshot_id": null, "metadata": {}, "id": "8411a2b3-f03e-4815-b5e8-2bb14a0c54a7", "size": 1}}

Tags: volumes
Eoghan Glynn (eglynn)
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/10047

Revision history for this message
Eoghan Glynn (eglynn) wrote :

Patch proposed to line up Tempest with the new status code:

  https://review.openstack.org/10058

Revision history for this message
John Griffith (john-griffith) wrote :

I'd propose a discussion is raised via the ML as this would be a change in API behavior. The 201 response is correct in my opinion but we should make sure folks are aware of the proposal and get agreement.

Revision history for this message
Eoghan Glynn (eglynn) wrote :

Hi John,

I've raised the issue on the openstack-dev list:

  http://lists.openstack.org/pipermail/openstack-dev/2012-July/000132.html

Cheers,
Eoghan

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

Reviewed: https://review.openstack.org/10047
Committed: http://github.com/openstack/nova/commit/3f71934f0e05b43c2093104c0412e46f5343595a
Submitter: Jenkins
Branch: master

commit 3f71934f0e05b43c2093104c0412e46f5343595a
Author: Eoghan Glynn <email address hidden>
Date: Fri Jul 20 12:00:12 2012 +0100

    Return location header on volume creation

    Partially addresses LP 1026600

    Normal RESTful idiom would dictate that the "Location" header is set
    to reference the newly created resource.

    We defer lining up the status code returned with generally accepted
    RESTful convention (currently "200 OK", should be "201 Created" or
    "202 Accepted") until the next API major version bump.

    There is already substantial code duplication between the volumes API
    and the os-volumes API extension - this will be addressed in a later
    patch.

    Change-Id: I166846a4cfea8adc8c156b8ae0e0d288681ac08c

Changed in nova:
status: In Progress → Fix Committed
Eoghan Glynn (eglynn)
Changed in nova:
milestone: none → folsom-3
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-3 → 2012.2
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.