This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.20 by this push:
     new dfd64b1a672 Ceph object store: Fix LocationConstraint error  (#10772)
dfd64b1a672 is described below

commit dfd64b1a672d726b36bb8c5905ce734e866e102e
Author: Abhisar Sinha <[email protected]>
AuthorDate: Thu May 1 11:47:18 2025 +0530

    Ceph object store: Fix LocationConstraint error  (#10772)
    
    * Don't set signingRegion as auto for creating the s3 client in ceph object 
store provider.
    
    * replace getBucketAcl with doesBucketExistV2 in 
CephObjectStoreDriverImplTest
---
 .../storage/datastore/driver/CephObjectStoreDriverImpl.java    | 10 ++++++----
 .../datastore/driver/CephObjectStoreDriverImplTest.java        |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
 
b/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
index 551d96eab9a..12920e37907 100644
--- 
a/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
+++ 
b/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
@@ -95,8 +95,8 @@ public class CephObjectStoreDriverImpl extends 
BaseObjectStoreDriverImpl {
         AmazonS3 s3client = getS3Client(storeId, accountId);
 
         try {
-            if (s3client.getBucketAcl(bucketName) != null) {
-                throw new CloudRuntimeException("Bucket already exists with 
name " + bucketName);
+            if (s3client.doesBucketExistV2(bucketName)) {
+                throw new CloudRuntimeException("Bucket already exists with 
the name: " + bucketName);
             }
         } catch (AmazonS3Exception e) {
             if (e.getStatusCode() != 404) {
@@ -221,9 +221,11 @@ public class CephObjectStoreDriverImpl extends 
BaseObjectStoreDriverImpl {
             if (user.isPresent()) {
                 logger.info("User already exists in Ceph RGW: " + username);
                 return true;
+            } else {
+                logger.debug("User does not exist. Creating user in Ceph RGW: 
" + username);
             }
         } catch (Exception e) {
-            logger.debug("User does not exist. Creating user in Ceph RGW: " + 
username);
+            logger.debug("Get user info failed for user {} with exception {}. 
Proceeding with user creation.",  username, e.getMessage());
         }
 
         try {
@@ -348,7 +350,7 @@ public class CephObjectStoreDriverImpl extends 
BaseObjectStoreDriverImpl {
                         new AWSStaticCredentialsProvider(
                                 new BasicAWSCredentials(accessKey, secretKey)))
                 .withEndpointConfiguration(
-                        new AwsClientBuilder.EndpointConfiguration(url, 
"auto"))
+                        new AwsClientBuilder.EndpointConfiguration(url, null))
                 .build();
 
         if (client == null) {
diff --git 
a/plugins/storage/object/ceph/src/test/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImplTest.java
 
b/plugins/storage/object/ceph/src/test/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImplTest.java
index d0cd2e86a22..33919107b5a 100644
--- 
a/plugins/storage/object/ceph/src/test/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImplTest.java
+++ 
b/plugins/storage/object/ceph/src/test/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImplTest.java
@@ -96,7 +96,7 @@ public class CephObjectStoreDriverImplTest {
         when(bucketDao.findById(anyLong())).thenReturn(new 
BucketVO(bucket.getName()));
         Bucket bucketRet = cephObjectStoreDriverImpl.createBucket(bucket, 
false);
         assertEquals(bucketRet.getName(), bucket.getName());
-        verify(rgwClient, times(1)).getBucketAcl(anyString());
+        verify(rgwClient, times(1)).doesBucketExistV2(anyString());
         verify(rgwClient, times(1)).createBucket(anyString());
     }
 

Reply via email to