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

@ -152,12 +152,8 @@ def get_image_layer(namespace, repository, image_id, headers):
image_id=image_id)
try:
path = store.blob_path(repo_image.storage.content_checksum)
if not repo_image.storage.cas_path:
path = store.v1_image_layer_path(repo_image.storage.uuid)
logger.info('Serving legacy v1 image from path: %s', path)
logger.debug('Looking up the direct download URL')
path = model.storage.get_layer_path(repo_image.storage)
logger.debug('Looking up the direct download URL for path: %s', path)
direct_download_url = store.get_direct_download_url(repo_image.storage.locations, path)
if direct_download_url:
@ -528,11 +524,7 @@ def process_image_changes(namespace, repository, image_id):
parent_trie.frombytes(parent_trie_bytes)
# Read in the file entries from the layer tar file
layer_path = store.blob_path(repo_image.storage.content_checksum)
if not repo_image.storage.cas_path:
logger.info('Processing diffs for newly stored v1 image at %s', layer_path)
layer_path = store.v1_image_layer_path(uuid)
layer_path = model.storage.get_layer_path(repo_image.storage)
with store.stream_read_file(image.storage.locations, layer_path) as layer_tar_stream:
removed_files = set()
layer_files = changes.files_and_dirs_from_tar(layer_tar_stream,