Reviewed: https://review.openstack.org/434558 Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=dbdc35bb1ae056444c8deb70bf9ad7fe85c07d72 Submitter: Jenkins Branch: master
commit dbdc35bb1ae056444c8deb70bf9ad7fe85c07d72 Author: Dharini Chandrasekar <[email protected]> Date: Wed Feb 15 23:34:31 2017 +0000 Do not serve partial img download reqs from cache Currently, when a partial download request for an image is received via v2 api with caching enabled, * For a new, uncached image: An attempt to cache (tee'ing) the partially downloaded image is made which is not desirable. While attempting to do this, the 206 gets converted to 500 due to a checksum mismatch of the partial image getting cached vs the entire image. * For an already cached image: Cache middleware layer serves the request but sends the entire image (200 instead of 206) This patch prevents caching of any partial images that are being downloaded using v2 api and ensures that any partial download requests are not served from cache. Change-Id: I3586c4eda0c36392d3436980f766ed1dd910b47c Closes-Bug: 1664709 ** Changed in: glance Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1664709 Title: Partial download of image fails when using image caching Status in Glance: Fix Released Bug description: When using Content-Range for a partial download of an image with image caching enabled, the partial download fails due to a cache error as in [0] This is because, the downloaded image is also getting cached using tee-iter in image_cache/__init__.py. Here there is a check for the images checksum and the download's checksum. With partial download, there is a mismatch of the full image checksum and the partial image checksum resulting in a 500. Steps to reproduce: 1. Create an image glance image-create --name test1 --visibility public --container-format bare --disk-format qcow2 < /home/stack/devstack/local.conf 2. Verify image creation and run the script to do a partial download. 2.a. glance image-list +--------------------------------------+---------------------------------+ | ID | Name | +--------------------------------------+---------------------------------+ | a3e38525-ad23-4ccb-9641-841f432ecf4a | cirros-0.3.4-x86_64-uec | | b3d0a0b6-5082-4250-a3d2-951992343a6e | cirros-0.3.4-x86_64-uec-kernel | | d123b95a-b00a-4db9-891b-a965c254581b | cirros-0.3.4-x86_64-uec-ramdisk | | 59c7e82a-6150-46b6-b19f-b93396bd5d8b | test1 | +--------------------------------------+---------------------------------+ 2.b. Execute the script that will request for a partial download of the above created image. [1] Fails with a 500. Traceback is as here: [2] The full download goes through successfully though. [3] [0] https://github.com/openstack/glance/blob/master/glance/image_cache/__init__.py#L360-L364 [1] http://paste.openstack.org/show/598886/ [2] http://paste.openstack.org/show/598881/ [3] http://paste.openstack.org/show/598887/ We need to educate cache here about a partial download to prevent this. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1664709/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

