500 response when trying to create a server from a deleted image

Bug #1155458 reported by Matthew Sherborne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Matthew Sherborne
nova (Ubuntu)
Fix Released
Undecided
Matthew Sherborne

Bug Description

After an image cleanup, I noticed the API will return a 500 if I try to create a server with an id of an image that has been deleted. The expected behavior would be a 400 stating that the user provided a bad image id. This is the current behavior if I pass in a random invalid id.

Steps to reproduce:

1. Take a snapshot of an existing server and note the id

2. Delete the snapshot

3. Try to create a new server using the id of the deleted image. Instead of a 400 Bad Request (no image found), a generic 500 is returned

Tags: api image
Changed in nova (Ubuntu):
assignee: nobody → Matthew Sherborne (msherborne+openstack)
status: New → In Progress
Michael Still (mikal)
Changed in nova:
assignee: nobody → Matthew Sherborne (msherborne+openstack)
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Michael Still (mikal) wrote :

@Matthew -- are you still working on this one?

Revision history for this message
Matthew Sherborne (msherborne+openstack) wrote :

@mikalstill

Yes. Working on it today :)

It seems that the trouble starts when the nova client requests the deleted image, the server happily replies with:

REQ: curl -i https://dfw.servers.api.rackspacecloud.com/v2/641237/images/088d978f-c387-41bd-83c7-918a0d4b38c0 -X GET -H "X-Auth-Project-Id: 641237" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: bf8001da-14a5-4dbc-a72f-3d1c4d92059a"

RESP: [200] {'date': 'Wed, 24 Apr 2013 02:00:17 GMT', 'content-length': '666', 'content-type': 'application/json', 'x-compute-request-id': 'req-2adcb4df-5203-419c-86cd-3cbb4fdd5b60', 'server': 'Jetty(8.0.y.z-SNAPSHOT)'}
RESP BODY: {"image": {"status": "DELETED", "updated": "2013-04-24T01:50:50Z", "name": "temp_snapshot", "links": [{"href": "https://dfw.servers.api.rackspacecloud.com/v2/641237/images/088d978f-c387-41bd-83c7-918a0d4b38c0", "rel": "self"}, {"href": "https://dfw.servers.api.rackspacecloud.com/641237/images/088d978f-c387-41bd-83c7-918a0d4b38c0", "rel": "bookmark"}, {"href": "https://dfw.servers.api.rackspacecloud.com/641237/images/088d978f-c387-41bd-83c7-918a0d4b38c0", "type": "application/vnd.openstack.image", "rel": "alternate"}], "created": "2013-04-24T01:32:16Z", "progress": 0, "minRam": 512, "minDisk": 20, "id": "088d978f-c387-41bd-83c7-918a0d4b38c0", "metadata": {}}}

------

I think the proper behaviour should be, don't show deleted images to the user, even if they request them by ID. Only admin's should see deleted images.

I'm not 100% sure yet if showing deleted images is bad. Do you have an opinon @mikalstill ?

Currently I'm digging into the nova code to see what's happening there.

Revision history for this message
Matthew Sherborne (msherborne+openstack) wrote :

Though I was able to reproduce it earlier, now that we've upgraded, it has been fixed.

However I've added 2 extra tests that should make doubly sure.

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

Reviewed: https://review.openstack.org/27790
Committed: http://github.com/openstack/nova/commit/7fa5e7f06cc767e523c79b39295b847256bbc9d8
Submitter: Jenkins
Branch: master

commit 7fa5e7f06cc767e523c79b39295b847256bbc9d8
Author: Matthew Sherborne <email address hidden>
Date: Tue Apr 30 07:19:03 2013 +1000

    Create instance with deleting image

    If we attempt to create a new instance with an image that has just now
    been deleted in glance, (ie. status="DELETED", but deleted=False).

    The server should throw a 4XX error rather than a 5XX error.

    This commit just adds tests.

    Tests bug 1155458
    Change-Id: Ifae470e96ddc4526ef67581a1d7171ccc5fd32b7

Changed in nova:
status: Triaged → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
James Page (james-page)
Changed in nova (Ubuntu):
status: In Progress → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.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.