From 2d6b645d23fe46c2e40fa29ff3f0d2eedaa9a3c7 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 9 Jan 2019 17:16:15 -0800 Subject: [PATCH] qa/rgw: support for storage classes Signed-off-by: Yehuda Sadeh --- qa/suites/rgw/multifs/overrides.yaml | 2 ++ qa/suites/rgw/verify/overrides.yaml | 1 + qa/tasks/rgw.py | 34 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/qa/suites/rgw/multifs/overrides.yaml b/qa/suites/rgw/multifs/overrides.yaml index 161e1e378da..339784d3ce5 100644 --- a/qa/suites/rgw/multifs/overrides.yaml +++ b/qa/suites/rgw/multifs/overrides.yaml @@ -6,3 +6,5 @@ overrides: debug rgw: 20 rgw crypt s3 kms encryption keys: testkey-1=YmluCmJvb3N0CmJvb3N0LWJ1aWxkCmNlcGguY29uZgo= testkey-2=aWIKTWFrZWZpbGUKbWFuCm91dApzcmMKVGVzdGluZwo= rgw crypt require ssl: false + rgw: + storage classes: LUKEWARM, FROZEN diff --git a/qa/suites/rgw/verify/overrides.yaml b/qa/suites/rgw/verify/overrides.yaml index ed3dec8e2df..8b0b5cff0a3 100644 --- a/qa/suites/rgw/verify/overrides.yaml +++ b/qa/suites/rgw/verify/overrides.yaml @@ -7,3 +7,4 @@ overrides: rgw crypt require ssl: false rgw: compression type: random + storage classes: LUKEWARM, FROZEN diff --git a/qa/tasks/rgw.py b/qa/tasks/rgw.py index 42941512f79..babfa5d5bc9 100644 --- a/qa/tasks/rgw.py +++ b/qa/tasks/rgw.py @@ -228,6 +228,34 @@ def configure_compression(ctx, clients, compression): check_status=True) yield +@contextlib.contextmanager +def configure_storage_classes(ctx, clients, storage_classes): + """ set a compression type in the default zone placement """ + + sc = [s.strip() for s in storage_classes.split(',')] + + for client in clients: + # 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) + + for storage_class in sc: + log.info('Configuring storage class type = %s', storage_class) + rgwadmin(ctx, client, + cmd=['zonegroup', 'placement', 'add', + '--rgw-zone', 'default', + '--placement-id', 'default-placement', + '--storage-class', storage_class], + check_status=True) + rgwadmin(ctx, client, + cmd=['zone', 'placement', 'add', + '--rgw-zone', 'default', + '--placement-id', 'default-placement', + '--storage-class', storage_class, + '--data-pool', 'default.rgw.buckets.data.' + storage_class.lower()], + check_status=True) + yield + @contextlib.contextmanager def task(ctx, config): """ @@ -287,6 +315,7 @@ def task(ctx, config): ctx.rgw.cache_pools = bool(config.pop('cache-pools', False)) ctx.rgw.frontend = config.pop('frontend', 'civetweb') ctx.rgw.compression_type = config.pop('compression type', None) + ctx.rgw.storage_classes = config.pop('storage classes', None) default_cert = config.pop('ssl certificate', None) ctx.rgw.data_pool_pg_size = config.pop('data_pool_pg_size', 64) ctx.rgw.index_pool_pg_size = config.pop('index_pool_pg_size', 64) @@ -305,6 +334,11 @@ def task(ctx, config): lambda: configure_compression(ctx=ctx, clients=clients, compression=ctx.rgw.compression_type), ]) + if ctx.rgw.storage_classes: + subtasks.extend([ + lambda: configure_storage_classes(ctx=ctx, clients=clients, + storage_classes=ctx.rgw.storage_classes), + ]) subtasks.extend([ lambda: start_rgw(ctx=ctx, config=config, clients=clients), ])