Merge pull request #970 from coreos-inc/disableverbcaching
Disable derived image storage entirely until we fix it to be by image…
This commit is contained in:
commit
1eb019cd16
1 changed files with 25 additions and 25 deletions
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import uuid
|
||||||
|
|
||||||
from flask import redirect, Blueprint, abort, send_file, make_response
|
from flask import redirect, Blueprint, abort, send_file, make_response
|
||||||
|
|
||||||
|
@ -166,27 +167,26 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
|
||||||
track_and_log('repo_verb', repo_image.repository, tag=tag, verb=verb, **kwargs)
|
track_and_log('repo_verb', repo_image.repository, tag=tag, verb=verb, **kwargs)
|
||||||
|
|
||||||
# Lookup/create the derived image storage for the verb.
|
# Lookup/create the derived image storage for the verb.
|
||||||
derived = model.storage.find_or_create_derived_storage(repo_image.storage, verb,
|
#derived = model.storage.find_or_create_derived_storage(repo_image.storage, verb,
|
||||||
store.preferred_locations[0])
|
# store.preferred_locations[0])
|
||||||
|
|
||||||
if not derived.uploading:
|
#if not derived.uploading:
|
||||||
logger.debug('Derived %s image %s exists in storage', verb, derived.uuid)
|
# logger.debug('Derived %s image %s exists in storage', verb, derived.uuid)
|
||||||
derived_layer_path = model.storage.get_layer_path(derived)
|
# derived_layer_path = model.storage.get_layer_path(derived)
|
||||||
download_url = store.get_direct_download_url(derived.locations, derived_layer_path)
|
# download_url = store.get_direct_download_url(derived.locations, derived_layer_path)
|
||||||
if download_url:
|
# if download_url:
|
||||||
logger.debug('Redirecting to download URL for derived %s image %s', verb, derived.uuid)
|
# logger.debug('Redirecting to download URL for derived %s image %s', verb, derived.uuid)
|
||||||
return redirect(download_url)
|
# return redirect(download_url)
|
||||||
|
|
||||||
# Close the database handle here for this process before we send the long download.
|
# # Close the database handle here for this process before we send the long download.
|
||||||
database.close_db_filter(None)
|
# database.close_db_filter(None)
|
||||||
|
|
||||||
logger.debug('Sending cached derived %s image %s', verb, derived.uuid)
|
# logger.debug('Sending cached derived %s image %s', verb, derived.uuid)
|
||||||
return send_file(store.stream_read_file(derived.locations, derived_layer_path))
|
# return send_file(store.stream_read_file(derived.locations, derived_layer_path))
|
||||||
|
|
||||||
# Load the full image list for the image.
|
derived_uuid = str(uuid.uuid4())
|
||||||
full_image_list = model.image.get_image_layers(repo_image)
|
|
||||||
|
|
||||||
logger.debug('Building and returning derived %s image %s', verb, derived.uuid)
|
logger.debug('Building and returning derived %s image %s', verb, derived_uuid)
|
||||||
|
|
||||||
# Load the image's JSON layer.
|
# Load the image's JSON layer.
|
||||||
if not image_json:
|
if not image_json:
|
||||||
|
@ -207,23 +207,23 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
|
||||||
args, finished=_cleanup)
|
args, finished=_cleanup)
|
||||||
|
|
||||||
client_queue_file = QueueFile(queue_process.create_queue(), 'client')
|
client_queue_file = QueueFile(queue_process.create_queue(), 'client')
|
||||||
storage_queue_file = QueueFile(queue_process.create_queue(), 'storage')
|
#storage_queue_file = QueueFile(queue_process.create_queue(), 'storage')
|
||||||
|
|
||||||
# If signing is required, add a QueueFile for signing the image as we stream it out.
|
# If signing is required, add a QueueFile for signing the image as we stream it out.
|
||||||
signing_queue_file = None
|
#signing_queue_file = None
|
||||||
if sign and signer.name:
|
#if sign and signer.name:
|
||||||
signing_queue_file = QueueFile(queue_process.create_queue(), 'signing')
|
# signing_queue_file = QueueFile(queue_process.create_queue(), 'signing')
|
||||||
|
|
||||||
# Start building.
|
# Start building.
|
||||||
queue_process.run()
|
queue_process.run()
|
||||||
|
|
||||||
# Start the storage saving.
|
# Start the storage saving.
|
||||||
storage_args = (verb, derived.uuid, derived.locations, storage_queue_file)
|
#storage_args = (verb, derived_uuid, derived.locations, storage_queue_file)
|
||||||
QueueProcess.run_process(_write_synthetic_image_to_storage, storage_args, finished=_cleanup)
|
#QueueProcess.run_process(_write_synthetic_image_to_storage, storage_args, finished=_cleanup)
|
||||||
|
|
||||||
if sign and signer.name:
|
#if sign and signer.name:
|
||||||
signing_args = (verb, derived.uuid, signing_queue_file)
|
# signing_args = (verb, derived_uuid, signing_queue_file)
|
||||||
QueueProcess.run_process(_sign_sythentic_image, signing_args, finished=_cleanup)
|
# QueueProcess.run_process(_sign_sythentic_image, signing_args, finished=_cleanup)
|
||||||
|
|
||||||
# Close the database handle here for this process before we send the long download.
|
# Close the database handle here for this process before we send the long download.
|
||||||
database.close_db_filter(None)
|
database.close_db_filter(None)
|
||||||
|
|
Reference in a new issue