From 4630db9206e11e2856776cc2eeb16436983fcb00 Mon Sep 17 00:00:00 2001 From: benthompson15 Date: Tue, 27 Sep 2022 11:49:20 -0500 Subject: [PATCH] MCOL-5177: Error handling for HTTP 301 response from AWS S3. (#2570) --- storage-manager/src/S3Storage.cpp | 11 ++++++++--- utils/libmarias3/libmarias3 | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/storage-manager/src/S3Storage.cpp b/storage-manager/src/S3Storage.cpp index 22560b41a..a07c79863 100644 --- a/storage-manager/src/S3Storage.cpp +++ b/storage-manager/src/S3Storage.cpp @@ -67,12 +67,13 @@ const int s3err_to_errno[] = { EBADMSG, // 4 MS3_ERR_RESPONSE_PARSE ECOMM, // 5 MS3_ERR_REQUEST_ERROR ENOMEM, // 6 MS3_ERR_OOM - EINVAL, // 7 MS3_ERR_IMPOSSIBLE. Will have to look through the code to find out what this is exactly. + EINVAL, // 7 MS3_ERR_IMPOSSIBLE. Will have to look through the code to find out what this is exactly. EKEYREJECTED, // 8 MS3_ERR_AUTH ENOENT, // 9 MS3_ERR_NOT_FOUND EPROTO, // 10 MS3_ERR_SERVER EMSGSIZE, // 11 MS3_ERR_TOO_BIG - EKEYREJECTED // 12 MS3_ERR_AUTH_ROLE + EKEYREJECTED, // 12 MS3_ERR_AUTH_ROLE + EFAULT // 13 MS3_ERR_ENDPOINT }; const char* s3err_msgs[] = {"All is well", @@ -87,7 +88,8 @@ const char* s3err_msgs[] = {"All is well", "Object not found", "Unknown error code in response", "Data to PUT is too large; 4GB maximum length", - "Authentication failed, token has expired"}; + "Authentication failed, token has expired", + "Configured bucket does not match endpoint location"}; S3Storage::ScopedConnection::ScopedConnection(S3Storage* s, ms3_st* m) : s3(s), conn(m) { @@ -506,6 +508,9 @@ int S3Storage::putObject(const boost::shared_array data, size_t len, co logger->log(LOG_ERR, "S3Storage::putObject(): failed to PUT, got '%s'. bucket = %s, key = %s.", s3err_msgs[s3err], bucket.c_str(), destKey.c_str()); errno = s3err_to_errno[s3err]; + if (s3err == MS3_ERR_ENDPOINT) + logger->log(LOG_ERR, "S3Storage::putObject(): Bucket location not match provided endpoint:, bucket = %s, endpoint = %s.", + bucket.c_str(), endpoint.c_str()); return -1; } return 0; diff --git a/utils/libmarias3/libmarias3 b/utils/libmarias3/libmarias3 index 32b94fff3..d7028f429 160000 --- a/utils/libmarias3/libmarias3 +++ b/utils/libmarias3/libmarias3 @@ -1 +1 @@ -Subproject commit 32b94fff37962aafc89884935addb2d656bdc750 +Subproject commit d7028f429bb247c622eb9948d9b8d5356f03cb79