Remove check for derived image storages on image storage

Derived image storages are now 1-to-1 with image storages, so we know they have already been removed at this point

Fixes #1067
This commit is contained in:
Joseph Schorr 2015-12-16 13:41:25 -05:00
parent 50f4612c72
commit f59f4e51e8

View file

@ -29,12 +29,9 @@ def garbage_collect_storage(storage_id_whitelist):
return (select_base_query
.switch(ImageStorage)
.join(Image, JOIN_LEFT_OUTER)
.switch(ImageStorage)
.join(DerivedStorageForImage, JOIN_LEFT_OUTER,
on=(ImageStorage.id == DerivedStorageForImage.derivative))
.where(ImageStorage.id << list(candidates))
.group_by(*group_by)
.having((fn.Count(Image.id) == 0) & (fn.Count(DerivedStorageForImage.id) == 0)))
.having(fn.Count(Image.id) == 0))
# Note: Both of these deletes must occur in the same transaction (unfortunately) because a
# storage without any placement is invalid, and a placement cannot exist without a storage.