Image upload metadata verified after its added to backing store
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
When adding an image to glance it seems like the upload process uploads to the backing store then the image metadata is verified. This seems backwards, since the image metadata seems like it should be verified before the upload to the backing store occurs (thus allowing it to fail early).
An example:
....
2012-04-14 01:50:36 15823 DEBUG [glance.
....
2012-04-14 01:50:39 15823 DEBUG [glance.
2012-04-14 01:50:39 15823 DEBUG [glance.registry] Updating image metadata for image 59b6ff21-
2012-04-14 01:50:39 15823 DEBUG [glance.registry] Updating image metadata for image 59b6ff21-
2012-04-14 01:50:39 15823 ERROR [glance.
2012-04-14 01:50:39 15823 ERROR [glance.
2012-04-14 01:50:39 15823 ERROR [glance.
2012-04-14 01:50:39 15823 ERROR [glance.
2012-04-14 01:50:39 15823 ERROR [glance.
2012-04-14 01:50:39 15823 ERROR [glance.
2012-04-14 01:50:39 15823 DEBUG [eventlet.
Shouldn't this fail before we spend time writing the data to a backing store instead of after?
Looking at the code, here's what appears to happen:
1) image metadata is updated with what the user provides
2) image status set to saving
3) image data streamed to store
4) image status set to active
This failure occurs when the image is being set to active since that's when we require a valid combination of disk_format and container_format. At this point, your image data has been uploaded to the store and you should be able to do another PUT with a valid disk_format/ container_ format and status='active'. I agree this isn't ideal, but its better than activating an image before we have any actual data.