[openstack-dev] [Glance] v2 api upload image-size issue with rbd backend store
Edward Hope-Morley
edward.hope-morley at canonical.com
Wed Sep 4 09:44:59 UTC 2013
Hi,
I'm hitting an issue with v2 api upload() and not sure the best way to
fix it so would appreciate some opinions/suggestions.
https://bugs.launchpad.net/glance/+bug/1213880
https://bugs.launchpad.net/python-glanceclient/+bug/1220197
So, currently doing cinder upload-to-image fails with v2 glance api and
RBD backend store. This is because v2 uses upload() (as opposed to
update() in v1) and does not accept an image-size. The v2 Glance api
upload() implementation checks the request content-length (which is
currently always zero) and then tries to create an RBD image of size
zero then write to it which fails. I have tried different solutions:
1. if image size is zero, resize for each chunk then write.
2. set content-length in glanceclient to size of image
Problem with 1 is that this implicitly disables 'Transfer-Encoding:
chunked' i.e. disables chunking. Problem with 2 is you get 2RTT of
network latency per write plus overhead of a resize.
So, I now think the best way to do this would be to modify the update
call to allow the glancelcient to send x-image-meta-size so that the
backend knows how big the image will be, create the image then write the
chunk(s) incrementally (kind of like the swift store).
Suggestions?
Ed.
More information about the OpenStack-dev
mailing list