glance v2 get image erro

Bug #1193310 reported by Ghe Rivero
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Feilong Wang
Glance Client
Invalid
Undecided
Unassigned

Bug Description

When trying to retrieve a glance image using the v2 api, you get an error:
# glance --os-image-api-version 2 --debug image-download image_id

    'utf8' codec can't decode byte 0xcc in position 1217: invalid continuation byte

This is because glance (glanceclient) expects a response of type content-type: application/octet-stream (glance v1 api)
but it's getting a Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked (glance v2 api)

https://github.com/openstack/python-glanceclient/blob/master/glanceclient/common/http.py#L213

Feilong Wang (flwang)
Changed in python-glanceclient:
status: New → Invalid
Changed in glance:
assignee: nobody → Fei Long Wang (flwang)
status: New → Confirmed
status: Confirmed → In Progress
Revision history for this message
Feilong Wang (flwang) wrote :

After investigation, I think the root cause is Glance will return the image data from cache if there is. However, in method _process_v2_request, the content type has never been configured. See:
    https://github.com/openstack/glance/blob/master/glance/api/middleware/cache.py#L162

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/35954

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

Reviewed: https://review.openstack.org/35954
Committed: http://github.com/openstack/glance/commit/5e71b5e11f056fc082e61e0e3a4515fcf1b9948f
Submitter: Jenkins
Branch: master

commit 5e71b5e11f056fc082e61e0e3a4515fcf1b9948f
Author: Fei Long Wang <email address hidden>
Date: Thu Jul 11 21:17:07 2013 +0800

    Fixes image-download error of v2

    When trying to retrieve a Glance image using the v2 api, user will
    get an error:

    'utf8' codec can't decode byte 0xcc in position 1217: invalid continuation byte

    This is because Glance client expects a response of type content-type:
    application/octet-stream but it's getting a Content-Type:

    text/html; charset=UTF-8 Transfer-Encoding: chunked

    The root cause is Glance will return the image data from cache if
    there is. However, in method _process_v2_request, the content type
    has never been configured. See:
    https://github.com/openstack/glance/blob/master/glance/api/middleware/cache.py#L162

    Fixes bug 1193310

    Change-Id: Icab5e28db63455358ab3919bd94c484411987e39

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-2 → 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.