Fix gc by using the v1/v2 storage location helper everywhere

This commit is contained in:
Jake Moshenko 2015-11-16 13:51:44 -05:00
parent 44d06b0c2e
commit 52125bbfed
4 changed files with 11 additions and 22 deletions

View file

@ -34,7 +34,7 @@ def garbage_collect_storage(storage_id_whitelist):
return
def placements_query_to_paths_set(placements_query):
return {(placement.location.name, config.store.image_path(placement.storage.uuid))
return {(placement.location.name, get_layer_path(placement.storage))
for placement in placements_query}
def orphaned_storage_query(select_base_query, candidates, group_by):
@ -213,6 +213,7 @@ def get_layer_path(storage_record):
""" Returns the path in the storage engine to the layer data referenced by the storage row. """
store = config.store
if not storage_record.cas_path:
logger.debug('Serving layer from legacy v1 path')
return store.v1_image_layer_path(storage_record.uuid)
return store.blob_path(storage_record.content_checksum)