]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/rgw: test_rgw_reshard.py just tries common ports 38871/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 18 Jan 2021 21:59:05 +0000 (16:59 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 9 Feb 2021 19:26:26 +0000 (14:26 -0500)
the 'sudo netstat | grep radosgw' command is causing failures:

  File "qa/workunits/rgw/test_rgw_reshard.py", line 53, in get_radosgw_port
    x = out.decode('utf8').split(" ")
AttributeError: 'bool' object has no attribute 'decode'

because when valgrind is enabled, the process name is 'valgrind' instead
of 'radosgw'

Signed-off-by: Casey Bodley <cbodley@redhat.com>
qa/workunits/rgw/test_rgw_reshard.py

index 14f4fe509946989e2e8f6ad59b78ad928cbea207..092a002b2bd7f03daed6472a5f4c901bcaf89433 100755 (executable)
@@ -5,6 +5,7 @@ import time
 import subprocess
 import json
 import boto3
+import botocore.exceptions
 
 """
 Rgw manual and dynamic resharding  testing against a running instance
@@ -47,15 +48,6 @@ def exec_cmd(cmd):
         return False
 
 
-def get_radosgw_port():
-    out = exec_cmd('sudo netstat -nltp | grep radosgw')
-    log.debug('output: %s' % out)
-    x = out.decode('utf8').split(" ")
-    port = [i for i in x if ':' in i][0].split(':')[1]
-    log.info('radosgw port: %s' % port)
-    return port
-
-
 class BucketStats:
     def __init__(self, bucket_name, bucket_id, num_objs=0, size_kb=0, num_shards=0):
         self.bucket_name = bucket_name
@@ -118,14 +110,22 @@ def main():
                               verify=False,
                               config=None,
                               )
+        try:
+            list(conn.buckets.limit(1)) # just verify we can list buckets
+        except botocore.exceptions.ConnectionError as e:
+            print(e)
+            raise
+        print('connected to', endpoint)
         return conn
 
-    port = get_radosgw_port()
-
-    if port == '80':
-        connection = boto_connect(port, ssl=False, proto='http')
-    elif port == '443':
-        connection = boto_connect(port, ssl=True, proto='https')
+    try:
+        connection = boto_connect('80', False, 'http')
+    except botocore.exceptions.ConnectionError:
+        try: # retry on non-privileged http port
+            connection = boto_connect('8000', False, 'http')
+        except botocore.exceptions.ConnectionError:
+            # retry with ssl
+            connection = boto_connect('443', True, 'https')
 
     # create a bucket
     bucket1 = connection.create_bucket(Bucket=BUCKET_NAME1)