]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/qa: enable s3-tests related to cloud-transition feature
authorSoumya Koduri <skoduri@redhat.com>
Fri, 22 Apr 2022 07:28:44 +0000 (12:58 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Tue, 17 May 2022 15:24:58 +0000 (20:54 +0530)
Added a new test-suite to configure cloudtier storage class and run related s3-tests.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
qa/suites/rgw/cloud-transition/+ [new file with mode: 0644]
qa/suites/rgw/cloud-transition/.qa [new symlink]
qa/suites/rgw/cloud-transition/cluster.yaml [new file with mode: 0644]
qa/suites/rgw/cloud-transition/overrides.yaml [new file with mode: 0644]
qa/suites/rgw/cloud-transition/supported-random-distro$ [new symlink]
qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml [new file with mode: 0644]
qa/tasks/rgw.py
qa/tasks/s3tests.py

diff --git a/qa/suites/rgw/cloud-transition/+ b/qa/suites/rgw/cloud-transition/+
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/suites/rgw/cloud-transition/.qa b/qa/suites/rgw/cloud-transition/.qa
new file mode 120000 (symlink)
index 0000000..fea2489
--- /dev/null
@@ -0,0 +1 @@
+../.qa
\ No newline at end of file
diff --git a/qa/suites/rgw/cloud-transition/cluster.yaml b/qa/suites/rgw/cloud-transition/cluster.yaml
new file mode 100644 (file)
index 0000000..3b2b084
--- /dev/null
@@ -0,0 +1,2 @@
+roles:
+- [mon.a, osd.0, osd.1, osd.2, mgr.0, client.0, client.1]
diff --git a/qa/suites/rgw/cloud-transition/overrides.yaml b/qa/suites/rgw/cloud-transition/overrides.yaml
new file mode 100644 (file)
index 0000000..40ca355
--- /dev/null
@@ -0,0 +1,14 @@
+overrides:
+  ceph:
+    conf:
+      client:
+        setuser: ceph
+        setgroup: ceph
+        debug rgw: 20
+        rgw crypt s3 kms backend: testing
+        rgw crypt s3 kms encryption keys: testkey-1=YmluCmJvb3N0CmJvb3N0LWJ1aWxkCmNlcGguY29uZgo= testkey-2=aWIKTWFrZWZpbGUKbWFuCm91dApzcmMKVGVzdGluZwo=
+        rgw crypt require ssl: false
+        rgw lc debug interval: 10
+  rgw:
+    storage classes: LUKEWARM, FROZEN
+    frontend: beast
diff --git a/qa/suites/rgw/cloud-transition/supported-random-distro$ b/qa/suites/rgw/cloud-transition/supported-random-distro$
new file mode 120000 (symlink)
index 0000000..0862b44
--- /dev/null
@@ -0,0 +1 @@
+.qa/distros/supported-random-distro$
\ No newline at end of file
diff --git a/qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml b/qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml
new file mode 100644 (file)
index 0000000..1420cb7
--- /dev/null
@@ -0,0 +1,31 @@
+tasks:
+- install:
+- ceph:
+- s3tests:
+    client.0:
+      force-repo: https://github.com/soumyakoduri/s3-tests.git
+      git_remote: https://github.com/soumyakoduri/
+      force-branch: cloudtier_tests
+      rgw_server: client.0
+      storage classes: LUKEWARM, FROZEN
+      extra_attrs: ["cloud_transition"]
+      lc_debug_interval: 10
+      cloudtier_tests: True
+- rgw:
+    storage classes: LUKEWARM, FROZEN
+    client.0:
+      port: 8000
+      cloudtier:
+        # cloudtier storage class params
+        cloud_storage_class: CLOUDTIER
+        cloud_client: client.1
+        cloud_regular_storage_class: LUKEWARM
+        cloud_target_storage_class: FROZEN
+        cloud_retain_head_object: "true"
+        cloud_target_path: "teuthology"
+      cloudtier_user:
+        # cloud-user creds to be created on cloud-client
+        cloud_secret: "abcefgh"
+        cloud_access_key: "12345678"
+    client.1:
+      port: 8001
index bde82de41756c97691f5fdfae8dd3233c21fe302..54d6b0b9e6a0a5a4a493da8cd4168ba7e6e26db1 100644 (file)
@@ -201,6 +201,59 @@ def start_rgw(ctx, config, clients):
                 exit_on_first_error=False
                 )
 
+        cloudtier_config = client_config.get('cloudtier')
+        if cloudtier_config is not None:
+            log.info('client %s - cloudtier config is -----------------%s ', client, cloudtier_config)
+            # configuring cloudtier
+
+            cloud_client = cloudtier_config.get('cloud_client')
+            cloud_storage_class = cloudtier_config.get('cloud_storage_class')
+            cloud_target_path = cloudtier_config.get('cloud_target_path')
+            cloud_target_storage_class = cloudtier_config.get('cloud_target_storage_class')
+            cloud_regular_storage_class = cloudtier_config.get('cloud_regular_storage_class')
+            cloud_retain_head_object = cloudtier_config.get('cloud_retain_head_object')
+
+            cloudtier_user = client_config.get('cloudtier_user')
+            cloud_access_key = cloudtier_user.get('cloud_access_key')
+            cloud_secret = cloudtier_user.get('cloud_secret')
+
+            # XXX: the 'default' zone and zonegroup aren't created until we run RGWRados::init_complete().
+            # issue a 'radosgw-admin user list' command to trigger this
+            rgwadmin(ctx, client, cmd=['user', 'list'], check_status=True)
+
+            endpoint = ctx.rgw.role_endpoints[cloud_client]
+
+            # create cloudtier storage class
+            tier_config_params = "endpoint=" + endpoint.url() + \
+                       ",access_key=" + cloud_access_key + \
+                        ",secret=" + cloud_secret + \
+                        ",retain_head_object=" + cloud_retain_head_object
+
+            if (cloud_target_path != None):
+                tier_config_params += ",target_path=" + cloud_target_path
+            if (cloud_target_storage_class != None):
+                tier_config_params += ",target_storage_class=" + cloud_target_storage_class
+
+            log.info('Configuring cloud-s3 tier storage class type = %s', cloud_storage_class)
+
+            rgwadmin(ctx, client,
+                  cmd=['zonegroup', 'placement', 'add',
+                        '--rgw-zone', 'default',
+                        '--placement-id', 'default-placement',
+                        '--storage-class', cloud_storage_class,
+                        '--tier-type', 'cloud-s3',
+                        '--tier-config', tier_config_params],
+                  check_status=True)
+
+            ## create cloudtier user with the access keys given on the cloud client
+            rgwadmin(ctx, cloud_client,
+                  cmd=['user', 'create', '--uid', 'cloud-tier-user',
+                    '--display-name', 'CLOUD TIER USER',
+                    '--access-key', cloud_access_key,
+                    '--secret', cloud_secret,
+                    '--caps', 'user-policy=*'],
+                    check_status=True)
+
         run_cmd = list(cmd_prefix)
         run_cmd.extend(rgw_cmd)
 
@@ -213,7 +266,7 @@ def start_rgw(ctx, config, clients):
             stdin=run.PIPE,
             wait=False,
             )
-
+     
     # XXX: add_daemon() doesn't let us wait until radosgw finishes startup
     for client in clients:
         endpoint = ctx.rgw.role_endpoints[client]
index a92b737728762527514a3348e94f73ff40c8fc7d..cf4ff06306ce05592e6efdc624ccc123cc424db5 100644 (file)
@@ -364,6 +364,27 @@ def configure(ctx, config):
         if lc_debug_interval:
             s3tests_conf['s3 main']['lc_debug_interval'] = lc_debug_interval
 
+        client_rgw_config = ctx.rgw.config.get(client)
+        if client_rgw_config:
+            cloudtier_config = client_rgw_config.get('cloudtier')
+            if cloudtier_config:
+                cloudtier_user = client_rgw_config.get('cloudtier_user')
+                cloud_client = cloudtier_config.get('cloud_client')
+                endpoint = ctx.rgw.role_endpoints.get(cloud_client)
+                s3tests_conf['s3 cloud']['host'] = endpoint.dns_name
+                s3tests_conf['s3 cloud']['port'] = endpoint.port
+                s3tests_conf['s3 cloud']['access_key'] = cloudtier_user.get('cloud_access_key')
+                s3tests_conf['s3 cloud']['secret_key'] = cloudtier_user.get('cloud_secret')
+                s3tests_conf['s3 cloud']['cloud_storage_class'] = cloudtier_config.get('cloud_storage_class')
+                s3tests_conf['s3 cloud']['storage_class'] = cloudtier_config.get('cloud_regular_storage_class')
+                s3tests_conf['s3 cloud']['retain_head_object'] = cloudtier_config.get('cloud_retain_head_object')
+                cloud_target_path = cloudtier_config.get('cloud_target_path')
+                cloud_target_storage_class = cloudtier_config.get('cloud_target_storage_class')
+                if (cloud_target_path != None):
+                    s3tests_conf['s3 cloud']['target_path'] = cloud_target_path
+                if (cloud_target_storage_class != None):
+                    s3tests_conf['s3 cloud']['target_storage_class'] = cloud_target_storage_class
+
         (remote,) = ctx.cluster.only(client).remotes.keys()
         remote.run(
             args=[
@@ -553,6 +574,16 @@ def task(ctx, config):
               sts_tests: True
               rgw_server: client.0
 
+    To run any cloud-transition tests don't forget to set a config variable named 'cloudtier_tests' to 'True' as follows::
+
+        tasks:
+        - ceph:
+        - rgw: [client.0 client.1]
+        - s3tests:
+            client.0:
+              cloudtier_tests: True
+              rgw_server: client.0
+
     """
     assert hasattr(ctx, 'rgw'), 's3tests must run after the rgw task'
     assert config is None or isinstance(config, list) \
@@ -582,6 +613,10 @@ def task(ctx, config):
             ctx.sts_variable = True
         else:
             ctx.sts_variable = False
+        if 'cloudtier_tests' in client_config:
+            ctx.cloudtier_variable = True
+        else:
+            ctx.cloudtier_variable = False
         #This will be the structure of config file when you want to run webidentity_test (sts-test)
         if ctx.sts_variable and "TOKEN" in os.environ:
             for client in clients:
@@ -629,6 +664,28 @@ def task(ctx, config):
                         }
                     ) 
 
+        elif ctx.cloudtier_variable:
+            #This will be the structure of config file when you want to run normal s3-tests
+            for client in clients:
+                endpoint = ctx.rgw.role_endpoints.get(client)
+                assert endpoint, 's3tests: no rgw endpoint for {}'.format(client)
+
+                s3tests_conf[client] = ConfigObj(
+                    indent_type='',
+                    infile={
+                        'DEFAULT':
+                            {
+                            'port'      : endpoint.port,
+                            'is_secure' : endpoint.cert is not None,
+                            'api_name'  : 'default',
+                            },
+                        'fixtures'   : {},
+                        's3 main'    : {},
+                        's3 alt'     : {},
+                        's3 tenant'  : {},
+                        's3 cloud'   : {},
+                        }
+                    ) 
         else:
             #This will be the structure of config file when you want to run normal s3-tests
             for client in clients: