s3api: fix volume assignment failure in copy operations (#8128)
Recent changes in the S3 unified copy strategy were constructing source and destination paths without the necessary BucketsPath prefix (typically /buckets). When these paths reached the Filer for volume assignment, it failed to resolve the correct collection and storage rules, defaulting to a disk type with no available capacity. This fix ensures all relevant paths in S3 copy handlers include the correct BucketsPath prefix for proper collection resolution. Fixes replication issue with Harbor upload via S3 API.
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
// Returns chunks and destination metadata that should be applied to the destination entry
|
||||
func (s3a *S3ApiServer) executeUnifiedCopyStrategy(entry *filer_pb.Entry, r *http.Request, dstBucket, srcObject, dstObject string) ([]*filer_pb.FileChunk, map[string][]byte, error) {
|
||||
// Detect encryption state (using entry-aware detection for multipart objects)
|
||||
srcPath := fmt.Sprintf("/%s/%s", r.Header.Get("X-Amz-Copy-Source-Bucket"), srcObject)
|
||||
dstPath := fmt.Sprintf("/%s/%s", dstBucket, dstObject)
|
||||
srcPath := fmt.Sprintf("%s/%s/%s", s3a.option.BucketsPath, r.Header.Get("X-Amz-Copy-Source-Bucket"), srcObject)
|
||||
dstPath := fmt.Sprintf("%s/%s/%s", s3a.option.BucketsPath, dstBucket, dstObject)
|
||||
state := DetectEncryptionStateWithEntry(entry, r, srcPath, dstPath)
|
||||
|
||||
// Debug logging for encryption state
|
||||
@@ -127,7 +127,7 @@ func (s3a *S3ApiServer) executeEncryptCopy(entry *filer_pb.Entry, r *http.Reques
|
||||
|
||||
if state.DstSSEKMS {
|
||||
// Use existing SSE-KMS copy logic - metadata is now generated internally
|
||||
chunks, dstMetadata, err := s3a.copyChunksWithSSEKMS(entry, r, dstBucket)
|
||||
chunks, dstMetadata, err := s3a.copyChunksWithSSEKMS(entry, r, dstBucket, dstPath)
|
||||
return chunks, dstMetadata, err
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ func (s3a *S3ApiServer) executeReencryptCopy(entry *filer_pb.Entry, r *http.Requ
|
||||
|
||||
if state.SrcSSEKMS && state.DstSSEKMS {
|
||||
// Use existing SSE-KMS copy logic - metadata is now generated internally
|
||||
chunks, dstMetadata, err := s3a.copyChunksWithSSEKMS(entry, r, dstBucket)
|
||||
chunks, dstMetadata, err := s3a.copyChunksWithSSEKMS(entry, r, dstBucket, dstPath)
|
||||
return chunks, dstMetadata, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user