]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/multisite: switch to boto3 in multisite test libraries
authorShilpa Jagannath <smanjara@redhat.com>
Tue, 20 Jan 2026 23:42:30 +0000 (18:42 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 11 Feb 2026 19:16:54 +0000 (14:16 -0500)
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
(cherry picked from commit c84efd9af5a4e2845745285ada994aad072eb2a0)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/test/rgw/rgw_multi/conn.py
src/test/rgw/rgw_multi/multisite.py
src/test/rgw/rgw_multi/tests.py

index e3f7cd7770405586a182fd463a276bb6fda7e156..1f914dc0e1518f1c804f14e75c3dd49d14d77bb1 100644 (file)
@@ -5,32 +5,28 @@ import boto.sts.connection
 import boto3
 from boto.regioninfo import RegionInfo
 
-def get_gateway_connection(gateway, credentials):
+def get_gateway_connection(gateway, credentials, region):
     """ connect to the given gateway """
     # Always create a new connection to the gateway to ensure each set of credentials gets its own connection
-    conn = boto.connect_s3(aws_access_key_id = credentials.access_key,
-                           aws_secret_access_key = credentials.secret,
-                           host = gateway.host,
-                           port = gateway.port,
-                           is_secure = False,
-                           calling_format = boto.s3.connection.OrdinaryCallingFormat())
+    conn = boto3.client('s3',
+                        endpoint_url='http://' + gateway.host + ':' + str(gateway.port),
+                        aws_access_key_id=credentials.access_key,
+                        aws_secret_access_key=credentials.secret,
+                        region_name=region)
     if gateway.connection is None:
         gateway.connection = conn
     return conn
 
-def get_gateway_secure_connection(gateway, credentials):
+def get_gateway_secure_connection(gateway, credentials, region):
     """ secure connect to the given gateway """
     if gateway.ssl_port == 0:
         return None
     if gateway.secure_connection is None:
-        gateway.secure_connection = boto.connect_s3(
-            aws_access_key_id = credentials.access_key,
-            aws_secret_access_key = credentials.secret,
-            host = gateway.host,
-            port = gateway.ssl_port,
-            is_secure = True,
-            validate_certs=False,
-            calling_format = boto.s3.connection.OrdinaryCallingFormat())
+        gateway.secure_connection = boto3.client('s3',
+                                                endpoint_url='http://' + gateway.host + ':' + str(gateway.port),
+                                                aws_access_key_id=credentials.access_key,
+                                                aws_secret_access_key=credentials.secret,
+                                                region_name=region)
     return gateway.secure_connection
 
 def get_gateway_iam_connection(gateway, credentials, region):
@@ -62,19 +58,6 @@ def get_gateway_sts_connection(gateway, credentials, region):
     return gateway.sts_connection
 
 
-def get_gateway_s3_client(gateway, credentials, region):
-  """ connect to boto3 s3 client api of the given gateway """
-  # Always create a new connection to the gateway to ensure each set of credentials gets its own connection
-  s3_client = boto3.client('s3',
-                           endpoint_url='http://' + gateway.host + ':' + str(gateway.port),
-                           aws_access_key_id=credentials.access_key,
-                           aws_secret_access_key=credentials.secret,
-                           region_name=region)
-  if gateway.s3_client is None:
-      gateway.s3_client = s3_client
-  return s3_client
-
-
 def get_gateway_sns_client(gateway, credentials, region):
   """ connect to boto3 s3 client api of the given gateway """
   if gateway.sns_client is None:
index 982ebe3ea7d8d483354365369f5bfc95cb7c1697..842344abdd3d6acaecaee06b161e3235d79d1e61 100644 (file)
@@ -3,7 +3,7 @@ from io import StringIO
 
 import json
 
-from .conn import get_gateway_connection, get_gateway_iam_connection, get_gateway_secure_connection, get_gateway_s3_client, get_gateway_sns_client, get_gateway_sts_connection, get_gateway_temp_s3_client
+from .conn import get_gateway_connection, get_gateway_iam_connection, get_gateway_secure_connection, get_gateway_sns_client, get_gateway_sts_connection, get_gateway_temp_s3_client
 
 class Cluster:
     """ interface to run commands against a distinct ceph cluster """
@@ -27,7 +27,6 @@ class Gateway:
         self.secure_connection = None
         self.ssl_port = ssl_port
         self.iam_connection = None
-        self.s3_client = None
         self.sns_client = None
         self.sts_connection = None
 
@@ -189,18 +188,16 @@ class ZoneConn(object):
             self.credentials = credentials
 
         if self.zone.gateways is not None:
-            self.conn = get_gateway_connection(self.zone.gateways[0], self.credentials)
-            self.secure_conn = get_gateway_secure_connection(self.zone.gateways[0], self.credentials)
-
             region = "" if self.zone.zonegroup is None else self.zone.zonegroup.name
             self.iam_conn = get_gateway_iam_connection(self.zone.gateways[0], self.credentials, region)
-            self.s3_client = get_gateway_s3_client(self.zone.gateways[0], self.credentials, region)
+            self.conn = get_gateway_connection(self.zone.gateways[0], self.credentials, region)
+            self.secure_conn = get_gateway_connection(self.zone.gateways[0], self.credentials, region)
             self.sns_client = get_gateway_sns_client(self.zone.gateways[0], self.credentials, region)
             self.temp_s3_client = None
             # create connections for the rest of the gateways (if exist)
             for gw in list(self.zone.gateways):
-                get_gateway_connection(gw, self.credentials)
-                get_gateway_secure_connection(gw, self.credentials)
+                get_gateway_connection(gw, self.credentials, region)
+                get_gateway_secure_connection(gw, self.credentials, region)
                 get_gateway_iam_connection(gw, self.credentials, region)
 
 
index b90e925e0b957d8856bb6f32fd2cfa956c9e6901..45226a58a910cdb1c3a089f4d050cfa22e5cb0f0 100644 (file)
@@ -75,12 +75,6 @@ run_prefix=''.join(random.choice(string.ascii_lowercase) for _ in range(6))
 num_roles = 0
 num_topic = 0
 
-def get_zone_connection(zone, credentials):
-    """ connect to the zone's first gateway """
-    if isinstance(credentials, list):
-        credentials = credentials[0]
-    return get_gateway_connection(zone.gateways[0], credentials)
-
 def mdlog_list(zone, period = None):
     cmd = ['mdlog', 'list']
     if period: