Openstack Glance: user_total_quota calculated incorrectly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Fix Released
|
High
|
Flavio Percoco | ||
Havana |
Fix Released
|
High
|
Flavio Percoco |
Bug Description
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-
openstack-
python-
How reproducible:
Steps to Reproduce:
1. vim /etc/glance/
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.
Changed in glance: | |
status: | New → Triaged |
importance: | Undecided → Critical |
assignee: | nobody → Fei Long Wang (flwang) |
Changed in glance: | |
milestone: | none → icehouse-2 |
Changed in glance: | |
status: | Fix Committed → Fix Released |
Changed in glance: | |
importance: | Critical → High |
Changed in glance: | |
milestone: | icehouse-2 → 2014.1 |
I tested it with my local env and can't reproduce it. And after reviewed the code, I don't think the 'killed' image size will be counted. See https:/ /github. com/openstack/ glance/ blob/master/ glance/ db/sqlalchemy/ api.py# L716
In other words, the size will multiply the number of locations. However, the locations number of 'killed' image is 0. So it won't be counted.
Please feel free reopen this bug if I missed anything. Thanks.