RFC2616 section 9.7 status code vs. nova server delete

Bug #1152623 reported by Attila Fazekas on 2013-03-08
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Low
stgleb

Bug Description

In REST client implementation is common good practice, when:
- request causes an synchronous and asynchronous effect , and
- the synchronous operation has any immediately visible effect ie. immediate subsequent request showing any change,
we should emphasize the synchronous behavior in the responses (Status code) (Or responding in way which does not distinguish the two cases).

However if the HTTP method is DELETE, the rule is the opposite!
If the resource on the request URL does not deleted the service MUST NOT response with 204.

"
   A successful response SHOULD be 200 (OK) if the response includes an
   entity describing the status, 202 (Accepted) if the action has not
   yet been enacted, or 204 (No Content) if the action has been enacted
   but the response does not include an entity.
" by RFC2616 section 9.7

It means if a DELETE request responded with 204 status code, I MUST get 404 in an immediate subsequent request, unless concurrent operation recreated the resource.

$ nova --debug delete ab0ebda6-2c21-4258-8934-1005b970fee5 ; nova --debug show ab0ebda6-2c21-4258-8934-1005b970fee5

Part of the output in the received order:
-----------------------------------------
REQ: curl -i http://10.34.69.149:8774/v2/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5 -X DELETE -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: c35f5783528d4131bf100604b2fabd6c"

send: u'DELETE /v2/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5 HTTP/1.1\r\nHost: 10.34.69.149:8774\r\nx-auth-project-id: admin\r\nx-auth-token: c35f5783528d4131bf100604b2fabd6c\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nuser-agent: python-novaclient\r\n\r\n'
reply: 'HTTP/1.1 204 No Content\r\n'
header: Content-Length: 0
header: X-Compute-Request-Id: req-53e3503a-8d73-4ffc-ba43-4bd5659a9e22
header: Content-Type: application/json
header: Date: Sat, 02 Mar 2013 18:26:21 GMT
RESP:{'date': 'Sat, 02 Mar 2013 18:26:21 GMT', 'status': '204', 'content-length': '0', 'content-type': 'application/json', 'x-compute-request-id': 'req-53e3503a-8d73-4ffc-ba43-4bd5659a9e22'}
-----------------------------------------------------
REQ: curl -i http://10.34.69.149:8774/v2/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: f74d6c7226c14915a26a81b540d43f3b"

connect: (10.34.69.149, 8774)
send: u'GET /v2/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5 HTTP/1.1\r\nHost: 10.34.69.149:8774\r\nx-auth-project-id: admin\r\nx-auth-token: f74d6c7226c14915a26a81b540d43f3b\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nuser-agent: python-novaclient\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: X-Compute-Request-Id: req-80c97c68-0b44-4650-b027-84a85ee04b86
header: Content-Type: application/json
header: Content-Length: 1502
header: Date: Sat, 02 Mar 2013 18:26:21 GMT
RESP:{'status': '200', 'content-length': '1502', 'content-location': u'http://10.34.69.149:8774/v2/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5', 'x-compute-request-id': 'req-80c97c68-0b44-4650-b027-84a85ee04b86', 'date': 'Sat, 02 Mar 2013 18:26:21 GMT', 'content-type': 'application/json'} {"server": {"status": "ACTIVE", "updated": "2013-03-02T18:26:21Z", "hostId": "31bdffcdffd5b869b87c9be3cdd700e29c4a08286d6d306622b4815a", "OS-EXT-SRV-ATTR:host": "new32.lithium.rhev.lab.eng.brq.redhat.com", "addresses": {"novanetwork": [{"version": 4, "addr": "192.168.32.2"}]}, "links": [{"href": "http://10.34.69.149:8774/v2/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5", "rel": "self"}, {"href": "http://10.34.69.149:8774/89a38fe6d3194864995ab0872905a65e/servers/ab0ebda6-2c21-4258-8934-1005b970fee5", "rel": "bookmark"}], "key_name": null, "image": {"id": "12e9c131-aaf4-4f73-9659-ed2da9759cd2", "links": [{"href": "http://10.34.69.149:8774/89a38fe6d3194864995ab0872905a65e/images/12e9c131-aaf4-4f73-9659-ed2da9759cd2", "rel": "bookmark"}]}, "OS-EXT-STS:task_state": "deleting", "OS-EXT-STS:vm_state": "active", "OS-EXT-SRV-ATTR:instance_name": "instance-00000003", "OS-EXT-SRV-ATTR:hypervisor_hostname": "new32.lithium.rhev.lab.eng.brq.redhat.com", "flavor": {"id": "1", "links": [{"href": "http://10.34.69.149:8774/89a38fe6d3194864995ab0872905a65e/flavors/1", "rel": "bookmark"}]}, "id": "ab0ebda6-2c21-4258-8934-1005b970fee5", "security_groups": [{"name": "default"}], "user_id": "1d2b871844434bbc99845ed11c3f897b", "name": "test", "created": "2013-03-02T17:19:44Z", "tenant_id": "89a38fe6d3194864995ab0872905a65e", "OS-DCF:diskConfig": "MANUAL", "accessIPv4": "", "accessIPv6": "", "progress": 0, "OS-EXT-STS:power_state": 1, "config_drive": "", "metadata": {}}}
---------------------------------------------------

Tags: api Edit Tag help
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
Changed in tempest:
assignee: nobody → Attila Fazekas (afazekas)
Changed in tempest:
status: New → Confirmed
importance: Undecided → Low
Changed in tempest:
assignee: Attila Fazekas (afazekas) → nobody
Jiajun Liu (ljjjustin) on 2013-10-17
Changed in nova:
assignee: nobody → Jiajun Liu (ljjjustin)

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

Changed in nova:
status: Confirmed → In Progress
Sean Dague (sdague) wrote :

Until this is changed in nova, it's not actually appropriate to have a tempest issue

no longer affects: tempest
Joe Gordon (jogo) on 2014-07-10
tags: added: api
Changed in nova:
status: In Progress → New
assignee: Jiajun Liu (ljjjustin) → nobody
Christopher Yeoh (cyeoh-0) wrote :

I think this is something we should just push off to fixing when the tasks api comes in. It's a backwards incompatible API change regardless and we might as well fix it properly.

Changed in nova:
status: New → Confirmed
stgleb (gstepanov) on 2016-06-29
Changed in nova:
assignee: nobody → stgleb (gstepanov)
status: Confirmed → In Progress

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

Change abandoned by Michael Still (<email address hidden>) on branch: master
Review: https://review.openstack.org/335564
Reason: This patch has been sitting unchanged for more than 12 weeks. I am therefore going to abandon it to keep the nova review queue sane. Please feel free to restore the change if you're still working on it.

Sean Dague (sdague) wrote :

It's fine that people want to change these, we're just not going to track them very effectively as bugs.

Changed in nova:
status: In Progress → Opinion
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints