Fix TypeError when downloading an image

Bug #1880827 reported by wangyu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Undecided
wangyu
Glance Client
Confirmed
Undecided
Unassigned

Bug Description

There were two patches to fix TypeError when downloading an image[1][2],but It seems that this problem still exists.

[1]https://bugs.launchpad.net/cinder/+bug/1798147
[2]https://bugs.launchpad.net/cinder/+bug/1811184

The glance documentation states that None (empty image) is a valid return value. We have to handle this.
https://docs.openstack.org/python-glanceclient/latest/reference/api/glanceclient.v2.images.html#glanceclient.v2.images.Controller.data

However,glanceclient.v2.images.Controller.data has a decorator: glanceclient.common.utils.add_req_id_to_object().
When cinder uses glanceclient.v2.images.Controller.data, return value: image_chunks is <class 'glanceclient.common.utils.RequestIdProxy'> which has two propertys. It follows:
RequestIdProxy.request_ids: request-id
RequestIdProxy.wrapped: An iterable body or None

So image_chunks can not be None at any time, it need to be fixed.

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

Fix proposed to branch: master
Review: https://review.opendev.org/731101

Changed in cinder:
assignee: nobody → wangyu (wangzhongyu)
status: New → In Progress
Revision history for this message
Mark Goddard (mgoddard) wrote :

Also hitting this in Train with glanceclient 2.17.0. My particular scenario is that I'm trying to use a file-backed image, but the default store in glance was switched to ceph.

Changed in python-glanceclient:
status: New → Confirmed
Revision history for this message
Mark Goddard (mgoddard) wrote :

I have a fix for glanceclient, will propose.

Revision history for this message
Mark Goddard (mgoddard) wrote :

To clarify, the problem happens because multiple glance-api servers are running, and only one has the file available locally. This correctly returns a 204, the other returns 200 but has an empty body.

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.