Merge pull request #1502 from coreos-inc/image-replication
Enable storage replication for V2 and add backfill tool
This commit is contained in:
commit
cad8746f9d
6 changed files with 93 additions and 12 deletions
|
@ -23,6 +23,7 @@ from endpoints.v2.errors import (BlobUnknown, ManifestInvalid, ManifestUnknown,
|
|||
NameInvalid)
|
||||
from endpoints.trackhelper import track_and_log
|
||||
from endpoints.notificationhelper import spawn_notification
|
||||
from util.registry.replication import queue_storage_replication
|
||||
from digest import digest_tools
|
||||
from data import model
|
||||
from data.database import RepositoryTag
|
||||
|
@ -441,7 +442,6 @@ def _write_manifest_itself(namespace_name, repo_name, manifest):
|
|||
image = model.image.synthesize_v1_image(repo, blob_storage, working_docker_id,
|
||||
v1_mdata.created, v1_mdata.comment, v1_mdata.command,
|
||||
v1_metadata_json, parent_image)
|
||||
|
||||
images_map[v1_mdata.docker_id] = image
|
||||
|
||||
if not layers:
|
||||
|
@ -453,6 +453,15 @@ def _write_manifest_itself(namespace_name, repo_name, manifest):
|
|||
leaf_layer_id = images_map[layers[-1].v1_metadata.docker_id].docker_image_id
|
||||
model.tag.store_tag_manifest(namespace_name, repo_name, tag_name, leaf_layer_id, manifest_digest,
|
||||
manifest.bytes)
|
||||
|
||||
# Queue all blob manifests for replication.
|
||||
# TODO(jschorr): Find a way to optimize this insertion.
|
||||
if features.STORAGE_REPLICATION:
|
||||
for mdata in layers:
|
||||
digest_str = str(mdata.digest)
|
||||
blob_storage = storage_map.get(digest_str)
|
||||
queue_storage_replication(namespace_name, blob_storage)
|
||||
|
||||
return (repo, tag_name, manifest_digest)
|
||||
|
||||
|
||||
|
|
Reference in a new issue