diff options
author | Redouane Kachach <rkachach@redhat.com> | 2023-02-23 17:16:39 +0100 |
---|---|---|
committer | Redouane Kachach <rkachach@redhat.com> | 2023-02-23 17:16:39 +0100 |
commit | 3e4ef2c967f24e5b993116a679225750faf528bc (patch) | |
tree | b8c058690ad4cab7ccfb3e688200b27641485c7e /qa/tasks/rgw_module.py | |
parent | Merge pull request #50226 from anthonyeleven/anthonyeleven/tweak-cephadm-trou... (diff) | |
download | ceph-3e4ef2c967f24e5b993116a679225750faf528bc.tar.xz ceph-3e4ef2c967f24e5b993116a679225750faf528bc.zip |
qa: Adding rgw multisite support
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
Diffstat (limited to 'qa/tasks/rgw_module.py')
-rw-r--r-- | qa/tasks/rgw_module.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/qa/tasks/rgw_module.py b/qa/tasks/rgw_module.py new file mode 100644 index 00000000000..0d2ca909432 --- /dev/null +++ b/qa/tasks/rgw_module.py @@ -0,0 +1,53 @@ +import logging +import yaml + +from teuthology import misc as teuthology + + +log = logging.getLogger(__name__) + + +def _shell(ctx, cluster_name, remote, args, extra_cephadm_args=[], **kwargs): + teuthology.get_testdir(ctx) + return remote.run( + args=[ + 'sudo', + ctx.cephadm, + '--image', ctx.ceph[cluster_name].image, + 'shell', + '-c', '/etc/ceph/{}.conf'.format(cluster_name), + '-k', '/etc/ceph/{}.client.admin.keyring'.format(cluster_name), + '--fsid', ctx.ceph[cluster_name].fsid, + ] + extra_cephadm_args + [ + '--', + ] + args, + **kwargs + ) + + +def apply(ctx, config): + """ + Apply spec + + tasks: + - rgw_module.apply: + specs: + - rgw_realm: myrealm1 + rgw_zonegroup: myzonegroup1 + rgw_zone: myzone1 + placement: + hosts: + - ceph-node-0 + - ceph-node-1 + spec: + rgw_frontend_port: 5500 + """ + cluster_name = config.get('cluster', 'ceph') + specs = config.get('specs', []) + y = yaml.dump_all(specs) + log.info(f'Applying spec(s):\n{y}') + _shell( + ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote, + ['ceph', 'rgw', 'realm', 'bootstrap', '-i', '-'], + stdin=y, + ) |