Glance download fails when size is 0

Bug #1257273 reported by Flavio Percoco
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Flavio Percoco
Icehouse
Fix Released
High
s iwata

Bug Description

Glance images are not being fetched by glance's API v1 when the size is 0. There are 2 things wrong with this behaviour:

1) Active images should always be ready to be downloaded, regardless they're locally or remotely stored.
2) The size shouldn't be the way to verify whether an image has some data or not.

https://git.openstack.org/cgit/openstack/glance/tree/glance/api/v1/images.py#n455

This is happening in the API v1, but it doesn't seem to be true for v2.

Changed in glance:
importance: Undecided → High
description: updated
Changed in glance:
assignee: nobody → Flavio Percoco (flaper87)
Revision history for this message
Geronimo Orozco (gorozco) wrote :

Which will be the verifier other than the size to validate the object has some data ?

Revision history for this message
Flavio Percoco (flaper87) wrote :

Hey Geronimo,

I'd like to consider 2 things related to this bug:

    1) Active images should *always* have data
    2) Even if the above is not True: Why should you verify it in first place?

Cheers,
FF

Revision history for this message
Yanis Guenane (yanis-guenane) wrote :

flaper87, do you think your fix will also fix this case. (This is the feeling I have from you 1. in the last comment)

https://bugs.launchpad.net/glance/+bug/1171677

To repeat :

#> touch /tmp/openstack
#> glance image-create --name test --disk-format qcow2 --container-format bare --file /tmp/openstack

If this is the case please let me know and I'll mark the other bug as a duplicate.

Thanks,

Revision history for this message
Yanis Guenane (yanis-guenane) wrote :

As a complement of the previous comment this is my output, an active image with size of 0

http://paste.openstack.org/show/54781/

Revision history for this message
Feilong Wang (flwang) wrote :

flaper87, one thing I'd like to raise is do you think the active image should always has a "size". IMHO, active image means it has a valid location associated with it. Then, Glance should be able to know the image size by the location(except Cinder backend :( )

Changed in glance:
status: New → Triaged
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

flwang, can I know why you think glance can't to get correct size value for cinder backed image?

https://github.com/openstack/glance/blob/master/glance/store/cinder.py#L160

Revision history for this message
Feilong Wang (flwang) wrote :

zhiyan, thanks for the poking. Pls skip that :)

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

Changed in glance:
status: Triaged → In Progress
Changed in glance:
milestone: none → juno-1
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/86546
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=503be24afa122eef08186001e54c1e1180114ccf
Submitter: Jenkins
Branch: master

commit 503be24afa122eef08186001e54c1e1180114ccf
Author: Jon Bernard <email address hidden>
Date: Fri Dec 13 11:12:34 2013 -0500

    Prevent creation of http images with invalid URIs

    Active images should always be ready to be downloaded, regardless
    they're locally or remotely stored. This patch prevents images with
    invalid location URIs from being created and entering the 'active'
    state with no data. This is only for the HTTP store.

    Closes-Bug: #1257273
    Co-authored: Jon Bernard <email address hidden>
    Change-Id: Iffce79b654cabe8397c85b2cc50c4b7f59733ea5

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/95656

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

Reviewed: https://review.openstack.org/95656
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=19de1156c7af684a22b0ecc558c5ea6ed24b7a78
Submitter: Jenkins
Branch: stable/icehouse

commit 19de1156c7af684a22b0ecc558c5ea6ed24b7a78
Author: Jon Bernard <email address hidden>
Date: Fri Dec 13 11:12:34 2013 -0500

    Prevent creation of http images with invalid URIs

    Active images should always be ready to be downloaded, regardless
    they're locally or remotely stored. This patch prevents images with
    invalid location URIs from being created and entering the 'active'
    state with no data. This is only for the HTTP store.

    Closes-Bug: #1257273
    Co-authored: Jon Bernard <email address hidden>

    Change-Id: Iffce79b654cabe8397c85b2cc50c4b7f59733ea5
    (cherry picked from commit 503be24afa122eef08186001e54c1e1180114ccf)

Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.