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.
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.
Tested AIO setup, RHEL 6.5 openstack-glance-2013.2.1-3.el6ost.noarch Image quota calculated correctly now.
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