From: Soumya Koduri Date: Fri, 6 May 2022 17:32:26 +0000 (+0530) Subject: rgw/qa: Add separate task for cloudtier tests X-Git-Tag: v18.0.0~854^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f846f6ff020fb31baa1777c4e246abde62729ade;p=ceph-ci.git rgw/qa: Add separate task for cloudtier tests Signed-off-by: Soumya Koduri --- diff --git a/qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml b/qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml index 1420cb7ba1e..3ea51881fb8 100644 --- a/qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml +++ b/qa/suites/rgw/cloud-transition/tasks/cloud_transition_s3tests.yaml @@ -1,6 +1,25 @@ tasks: - install: - ceph: +- rgw: + storage classes: LUKEWARM, FROZEN + client.0: + port: 8000 + client.1: + port: 8001 +- rgw-cloudtier: + client.0: + # 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" - s3tests: client.0: force-repo: https://github.com/soumyakoduri/s3-tests.git @@ -11,21 +30,3 @@ tasks: 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 diff --git a/qa/tasks/rgw.py b/qa/tasks/rgw.py index 54d6b0b9e6a..0cc54a3abd1 100644 --- a/qa/tasks/rgw.py +++ b/qa/tasks/rgw.py @@ -201,59 +201,6 @@ 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) @@ -460,6 +407,7 @@ def task(ctx, config): teuthology.deep_merge(config, overrides.get('rgw', {})) ctx.rgw = argparse.Namespace() + ctx.rgw_cloudtier = None ctx.rgw.ec_data_pool = bool(config.pop('ec-data-pool', False)) ctx.rgw.erasure_code_profile = config.pop('erasure_code_profile', {}) diff --git a/qa/tasks/rgw_cloudtier.py b/qa/tasks/rgw_cloudtier.py new file mode 100644 index 00000000000..ebcf6a9c9a4 --- /dev/null +++ b/qa/tasks/rgw_cloudtier.py @@ -0,0 +1,126 @@ +""" +rgw_cloudtier configuration routines +""" +import argparse +import contextlib +import logging + +from teuthology.orchestra import run +from teuthology import misc as teuthology +from teuthology import contextutil +from teuthology.exceptions import ConfigError +from tasks.util import get_remote_for_role +from tasks.util.rgw import rgwadmin, wait_for_radosgw +from teuthology.task import Task + +log = logging.getLogger(__name__) + +class RGWCloudTier(Task): + """ + Configure CloudTier storage class. + + To configure cloudtiering on any client:: + + tasks: + - ceph: + - rgw: + - rgw-cloudtier: + client.0: + cloud_storage_class: + cloud_client: + cloud_regular_storage_class: + cloud_target_storage_class: + cloud_retain_head_object: + cloud_target_path: + cloudtier_user: + cloud_secret: + cloud_access_key: + + """ + def __init__(self, ctx, config): + super(RGWCloudTier, self).__init__(ctx, config) + + def setup(self): + super(RGWCloudTier, self).setup() + + overrides = self.ctx.config.get('overrides', {}) + teuthology.deep_merge(self.config, overrides.get('rgw-cloudtier', {})) + + if not self.ctx.rgw: + raise ConfigError('rgw-cloudtier must run after the rgw task') + + self.ctx.rgw_cloudtier = argparse.Namespace() + self.ctx.rgw_cloudtier.config = self.config + + log.info('Configuring rgw cloudtier ...') + clients = self.config.keys() # http://tracker.ceph.com/issues/20417 + for client in clients: + client_config = self.config.get(client) + if client_config is None: + client_config = {} + + if client_config is not None: + log.info('client %s - cloudtier config is -----------------%s ', client, client_config) + # configuring cloudtier + + cloud_client = client_config.get('cloud_client') + cloud_storage_class = client_config.get('cloud_storage_class') + cloud_target_path = client_config.get('cloud_target_path') + cloud_target_storage_class = client_config.get('cloud_target_storage_class') + cloud_regular_storage_class = client_config.get('cloud_regular_storage_class') + cloud_retain_head_object = client_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(self.ctx, client, cmd=['user', 'list'], check_status=True) + + endpoint = self.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(self.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(self.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) + + log.info('Finished Configuring rgw cloudtier ...') + + cluster_name, daemon_type, client_id = teuthology.split_role(client) + client_with_id = daemon_type + '.' + client_id + client_with_cluster = cluster_name + '.' + client_with_id + self.ctx.daemons.get_daemon('rgw', client_with_id, cluster_name).restart() + log.info('restarted rgw daemon ...') + + (remote,) = self.ctx.cluster.only(client).remotes.keys() + wait_for_radosgw(endpoint.url(), remote) + + +task = RGWCloudTier diff --git a/qa/tasks/s3tests.py b/qa/tasks/s3tests.py index cf4ff06306c..9f1c458b85e 100644 --- a/qa/tasks/s3tests.py +++ b/qa/tasks/s3tests.py @@ -364,22 +364,24 @@ 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: + log.info('Before ctx.rgw_clouudtier %s ...', ctx.rgw_cloudtier) + if ctx.rgw_cloudtier is not None: + log.info(' ctx.rgw_cloudtier config is %s ...', ctx.rgw_cloudtier.config) + client_rgw_config = ctx.rgw_cloudtier.config.get(client) + if client_rgw_config: + log.info(' ctx.rgw_cloudtier config is %s ...', client_rgw_config) cloudtier_user = client_rgw_config.get('cloudtier_user') - cloud_client = cloudtier_config.get('cloud_client') + cloud_client = client_rgw_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') + s3tests_conf['s3 cloud']['cloud_storage_class'] = client_rgw_config.get('cloud_storage_class') + s3tests_conf['s3 cloud']['storage_class'] = client_rgw_config.get('cloud_regular_storage_class') + s3tests_conf['s3 cloud']['retain_head_object'] = client_rgw_config.get('cloud_retain_head_object') + cloud_target_path = client_rgw_config.get('cloud_target_path') + cloud_target_storage_class = client_rgw_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):