Partial download of image fails when using image caching

Bug #1664709 reported by Dharini Chandrasekar
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Dharini Chandrasekar

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.

Changed in glance:
assignee: nobody → Dharini Chandrasekar (dharini-chandrasekar)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

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 address hidden>
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
Revision history for this message
Drew Fisher (drew-fisher) wrote :

Would it be possible to backport this fix to Ocata?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 15.0.0.0b1

This issue was fixed in the openstack/glance 15.0.0.0b1 development milestone.

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.