Unreachable 'ImageSizeLimitExceeded' exception block in stage call

Bug #1732830 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Abhishek Kekane

Bug Description

ImageSizeLimitExceeded exception block [1] is unreachable in stage because
we are using sotre_backend.add (filesystem.add in this case) and it will
raise 'exceptions.StorageFull()' [2] if image file is too large (errno.EFBIG).

[1] https://github.com/openstack/glance/blob/master/glance/api/v2/image_data.py#L323
[2] https://github.com/openstack/glance_store/blob/master/glance_store/_drivers/filesystem.py#L691

Changed in glance:
assignee: nobody → Abhishek Kekane (abhishek-kekane)
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

I think Abhishek's analysis is correct. The upload() function, which also catches this exception, eventually uses some kind of limiting reader to store the image data, which is why it needs to catch ImageSizeLimitExceeded. But stage() is using store.add() directly, so it won't see that.

As a side point, the current import workflow will allow an end user to stage something super enormous; the size limit isn't checked until the import call happens. Just wanted to mention that.

Changed in glance:
status: New → Triaged
importance: Undecided → Low
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/521411

Changed in glance:
status: Triaged → In Progress
Revision history for this message
Erno Kuvaja (jokke) wrote :

Actually I'm not sure if that block is unreachable. The stage should utilize same mechanism for getting the data stream as upload and utilize the same limiting reader. If it does not _that_ is the actual bug as that's the only thing that is enforcing the image size limitation from our configuration.

Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :

Hi Erno,

As per your suggestion I have used LimitingReader and ensured that it will raise ImageSizeLimitExceeded if image size is greater than 'image_size_cap' set in the glance-api.conf

Changed in glance:
milestone: none → queens-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/521411
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=d48c8419ee73de275963f448a6718ff75f90a589
Submitter: Zuul
Branch: master

commit d48c8419ee73de275963f448a6718ff75f90a589
Author: Abhishek Kekane <email address hidden>
Date: Mon Nov 20 03:44:23 2017 +0000

    Utilize LimitingReader for staging data

    ImageSizeLimitExceeded exception block is unreachable in stage
    call because glance is using sotre_backend.add (filesystem.add
    in this case) and it will raise 'exceptions.StorageFull()' [1]
    if image file is too large (errno.EFBIG).

    Used LimitingReader to enforce the image size limitation which
    will raise ImageSizeLimitExceeded if image size is larger that
    config option 'image_size_cap'.

    [1] https://github.com/openstack/glance_store/blob/master/glance_store/_drivers/filesystem.py#L691

    Change-Id: I50821111ac4c782966ed1ccd48e92f8dd4100e62
    Closes-Bug: #1732830

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 16.0.0.0b2

This issue was fixed in the openstack/glance 16.0.0.0b2 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.