Bug 1043929 - Openstack Glance: user_total_quota calculated incorrectly
Summary: Openstack Glance: user_total_quota calculated incorrectly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance
Version: 4.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: z1
: 4.0
Assignee: Flavio Percoco
QA Contact: Tzach Shefi
URL:
Whiteboard:
Depends On:
Blocks: 985139
TreeView+ depends on / blocked
 
Reported: 2013-12-17 13:00 UTC by Tzach Shefi
Modified: 2016-04-26 23:59 UTC (History)
8 users (show)

Fixed In Version: openstack-glance-2013.2.1-3.el6ost
Doc Type: Bug Fix
Doc Text:
Previously in OpenStack Image, the quota space limit summed non-active images during the limit enforcement. As a result, used space never decreased even when images were deleted or killed. Now, images with a status of 'killed', 'pending_delete', or 'deleted' won't be added to the final storage used count. As a result, used space count is more accurate and will decrease as expected, when, for instance, images are deleted or killed.
Clone Of:
Environment:
Last Closed: 2014-01-23 14:23:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1261738 0 None None None Never
OpenStack gerrit 62897 0 None None None Never
Red Hat Product Errata RHBA-2014:0046 0 normal SHIPPED_LIVE Red Hat Enterprise Linux OpenStack Platform 4 Bug Fix and Enhancement Advisory 2014-01-23 00:51:59 UTC

Description Tzach Shefi 2013-12-17 13:00:42 UTC
Description of problem: Bug in quota calculation, if an image upload fails due to quota limit, the failed image size is still added to total storage sum figure! Thus future images may fail to upload even if it looks as quota hasn’t been reached yet. 


Version-Release number of selected component (if applicable):
RHEL 6.5 

python-glanceclient-0.12.0-1.el6ost.noarch
openstack-glance-2013.2-5.el6ost.noarch
python-glance-2013.2-5.el6ost.noarch

How reproducible:



Steps to Reproduce:
1. vim /etc/glance/glance-api.conf  user_storage_quota = 250mb (in byets)
2. service glance-api restart
3. Upload test small image - would be ok
4. Upload large image say 4Giga, - should fail with "Error unable to create new image" 

5. Try to upload another small file say 49MB. 


Actual results:

If the large i,age file or sum of failed uploaded images are more than the quota, any image size will fail to upload. 


Expected results:

I should be able to upload as long as the sum of all my images is less than configured qouta. 


Additional info:

Mysql show databases;
connect glance;
SELECT * FROM images;

Noticed all the images i tired, initial successful uploaded image status=”active”, images that i deleted status=”deleted”, images that failed to upload due to quota status=”killed”

I than calculated the sum of all the “killed” images.
Set a new quota of the above calculated value + 100MB, restarted glance-api service. 
Only than i was able to upload another image of 49MB. 

When i set a lower quota value (below the calculated sum of all the killed images) wasn’t able to upload any image. 

Images of status killed, which fail upload for any reason, should not be added to total storage sum calcualtion or quota.

Comment 2 Flavio Percoco 2013-12-18 11:36:21 UTC
This is indeed a bug. 

Looking at the code, it seems that the sqlalchemy driver is not filtering deleted / killed images out when calculating the disk usage.

https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L709

Will work on a fix for this.

Comment 4 Tzach Shefi 2014-01-16 15:04:27 UTC
Tested AIO setup, RHEL 6.5
openstack-glance-2013.2.1-3.el6ost.noarch

Image quota calculated correctly now.

Comment 9 Lon Hohberger 2014-02-04 17:20:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2014-0046.html


Note You need to log in before you can comment on or make changes to this bug.