Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: Fix big layer uploads for Ceph/RADOS driver (PROJQUAY-6586) #2601

Merged
merged 5 commits into from
Jan 16, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 28 additions & 7 deletions storage/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,10 +983,16 @@ def __init__(
secret_key,
bucket_name,
port=None,
maximum_chunk_size_mb=None,
server_side_assembly=True,
):
upload_params = {}
connect_kwargs = {
"endpoint_url": _build_endpoint_url(hostname, port=port, is_secure=is_secure),
"config": Config(
connect_timeout=600 if server_side_assembly == False else 60,
ibazulic marked this conversation as resolved.
Show resolved Hide resolved
read_timeout=600 if server_side_assembly == False else 60,
),
}

super(RadosGWStorage, self).__init__(
Expand All @@ -1000,6 +1006,13 @@ def __init__(
secret_key,
)

chunk_size = (
maximum_chunk_size_mb if maximum_chunk_size_mb is not None else 32
) # 32mb default, as used in Docker registry:2
self.maximum_chunk_size = chunk_size * 1024 * 1024

self.server_side_assembly = server_side_assembly

# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
def get_direct_download_url(
self, path, request_ip=None, expires_in=60, requires_cors=False, head=False, **kwargs
Expand All @@ -1019,13 +1032,21 @@ def get_direct_upload_url(self, path, mime_type, requires_cors=True):
return super(RadosGWStorage, self).get_direct_upload_url(path, mime_type, requires_cors)

def complete_chunked_upload(self, uuid, final_path, storage_metadata):
ibazulic marked this conversation as resolved.
Show resolved Hide resolved
self._initialize_cloud_conn()

# RadosGW does not support multipart copying from keys, so we are forced to join
# it all locally and then reupload.
# See https://github.com/ceph/ceph/pull/5139
chunk_list = self._chunk_list_from_metadata(storage_metadata)
self._client_side_chunk_join(final_path, chunk_list)
logger.debug("Multipart upload is set to {}.".format(self.server_side_assembly))
if self.server_side_assembly == True:
ibazulic marked this conversation as resolved.
Show resolved Hide resolved
logger.debug("Initiating multipart upload and server side assembly for final push.")
return super(RadosGWStorage, self).complete_chunked_upload(
uuid, final_path, storage_metadata
)
else:
logger.debug("Initiating client side chunk join for final assembly and push.")
logger.debug("Setting Boto timeout to 600 seconds in case of a large layer push.")
self._initialize_cloud_conn()
# Certain implementations of RadosGW do not support multipart copying from keys,
# so we are forced to join it all locally and then reupload.
# See https://github.com/ceph/ceph/pull/5139
chunk_list = self._chunk_list_from_metadata(storage_metadata)
self._client_side_chunk_join(final_path, chunk_list)


class RHOCSStorage(RadosGWStorage):
Expand Down