All database API's currently include deleted images in the calc of
storage usage. This is not an issue when deleted images don't have
locations. However, there are cases where a deleted image has deleted
locations as well and that causes the current algorithm to count those
locations as if they were allocating space.
Besides this bug, it makes sense to not load deleted / killed /
pending_delete images from the database if we're actually not
considering them as valid images.
The patch also filters out deleted locations.
NOTE: In the case of locations, it was not possible to add a test for
the deleted locations because it requires some changes that are not
worth in this patch. In order to mark a location as deleted, it's
necessary to go through the API and use a PATCH operation. Since this is
a database test, it doesn't make much sense to add API calls to it.
Calling the image_destroy function with an empty location list will
remove all the locations which won't help testing that specific case.
I'll work on a better solution for that in a follow-up patch.
Reviewed: https:/ /review. openstack. org/62897 /git.openstack. org/cgit/ openstack/ glance/ commit/ ?id=b35728019e0 eb89c213eed7bc3 5a1f062c99dcca
Committed: https:/
Submitter: Jenkins
Branch: master
commit b35728019e0eb89 c213eed7bc35a1f 062c99dcca
Author: Flavio Percoco <email address hidden>
Date: Wed Dec 18 15:18:17 2013 +0100
Filter out deleted images from storage usage
All database API's currently include deleted images in the calc of
storage usage. This is not an issue when deleted images don't have
locations. However, there are cases where a deleted image has deleted
locations as well and that causes the current algorithm to count those
locations as if they were allocating space.
Besides this bug, it makes sense to not load deleted / killed /
pending_delete images from the database if we're actually not
considering them as valid images.
The patch also filters out deleted locations.
NOTE: In the case of locations, it was not possible to add a test for
the deleted locations because it requires some changes that are not
worth in this patch. In order to mark a location as deleted, it's
necessary to go through the API and use a PATCH operation. Since this is
a database test, it doesn't make much sense to add API calls to it.
Calling the image_destroy function with an empty location list will
remove all the locations which won't help testing that specific case.
I'll work on a better solution for that in a follow-up patch.
DocImpact
Change-Id: I82f08a8f522c81 541e4f77597c2ba 0aeb68556ce
Closes-Bug: #1261738