From: Patrick Donnelly Date: Thu, 29 May 2025 16:11:22 +0000 (-0400) Subject: qa/tasks/ceph: allow cluster to be brought up with particular cephx key type X-Git-Tag: testing/wip-pdonnell-testing-20260210.212535~46 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16062ff85dc6b5c4cb4b1c09a084895509ae0f45;p=ceph-ci.git qa/tasks/ceph: allow cluster to be brought up with particular cephx key type For testing cephx upgrades from older key types. Signed-off-by: Patrick Donnelly --- diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index b29448b77c2..f78bdad87ec 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -708,6 +708,12 @@ def cluster(ctx, config): log.info("'use_existing_cluster' is true; skipping cluster creation") yield + cephx = config['cephx'] + key_type = cephx.get('key_type', None) + auth_tool_extra_args = [] + if key_type is not None: + auth_tool_extra_args.append(f'--key-type={key_type}') + testdir = teuthology.get_testdir(ctx) cluster_name = config['cluster'] data_dir = '{tdir}/{cluster}.data'.format(tdir=testdir, cluster=cluster_name) @@ -785,24 +791,24 @@ def cluster(ctx, config): firstmon = teuthology.get_first_mon(ctx, config, cluster_name) log.info('Setting up %s...' % firstmon) + authtool = [ + 'sudo', + 'adjust-ulimits', + 'ceph-coverage', + coverage_dir, + 'ceph-authtool', + *auth_tool_extra_args, + ] ctx.cluster.only(firstmon).run( args=[ - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - coverage_dir, - 'ceph-authtool', + *authtool, '--create-keyring', keyring_path, ], ) ctx.cluster.only(firstmon).run( args=[ - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - coverage_dir, - 'ceph-authtool', + *authtool, '--gen-key', '--name=mon.', keyring_path, @@ -840,11 +846,7 @@ def cluster(ctx, config): log.info('Creating admin key on %s...' % firstmon) ctx.cluster.only(firstmon).run( args=[ - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - coverage_dir, - 'ceph-authtool', + *authtool, '--gen-key', '--name=client.admin', '--cap', 'mon', 'allow *', @@ -884,11 +886,7 @@ def cluster(ctx, config): '-p', mgr_dir, run.Raw('&&'), - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - coverage_dir, - 'ceph-authtool', + *authtool, '--create-keyring', '--gen-key', '--name=mgr.{id}'.format(id=id_), @@ -911,11 +909,7 @@ def cluster(ctx, config): '-p', mds_dir, run.Raw('&&'), - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - coverage_dir, - 'ceph-authtool', + *authtool, '--create-keyring', '--gen-key', '--name=mds.{id}'.format(id=id_), @@ -947,8 +941,8 @@ def cluster(ctx, config): for role in teuthology.cluster_roles_of_type(roles_for_host, 'osd', cluster_name): _, _, id_ = teuthology.split_role(role) - mnt_point = DATA_PATH.format( - type_='osd', cluster=cluster_name, id_=id_) + + mnt_point = DATA_PATH.format(type_='osd', cluster=cluster_name, id_=id_) remote.run( args=[ 'sudo', @@ -1031,6 +1025,18 @@ def cluster(ctx, config): for role in teuthology.cluster_roles_of_type(roles_for_host, 'osd', cluster_name): _, _, id_ = teuthology.split_role(role) + + osd_dir = DATA_PATH.format(type_='osd', cluster=cluster_name, id_=id_) + remote.run( + args=[ + *authtool, + '--create-keyring', + '--gen-key', + '--name=osd.{id}'.format(id=id_), + osd_dir + '/keyring', + ], + ) + try: args = ['sudo', 'MALLOC_CHECK_=3', @@ -1040,7 +1046,6 @@ def cluster(ctx, config): '--no-mon-config', '--cluster', cluster_name, '--mkfs', - '--mkkey', '-i', id_, '--monmap', monmap_path] log_path = f'/var/log/ceph/{cluster_name}-osd.{id_}.log' @@ -1062,7 +1067,6 @@ def cluster(ctx, config): '--cluster', cluster_name, '--mkfs', - '--mkkey', '-i', id_, '--monmap', monmap_path, ], @@ -1118,11 +1122,7 @@ def cluster(ctx, config): run.wait( mons.run( args=[ - 'sudo', - 'adjust-ulimits', - 'ceph-coverage', - coverage_dir, - 'ceph-authtool', + *authtool, keyring_path, '--name={type}.{id}'.format( type=type_, @@ -1976,6 +1976,7 @@ def task(ctx, config): cluster=config['cluster'], mon_bind_msgr2=config.get('mon_bind_msgr2', True), mon_bind_addrvec=config.get('mon_bind_addrvec', True), + cephx=config.get('cephx', {}), )), lambda: run_daemon(ctx=ctx, config=config, type_='mon'), lambda: module_setup(ctx=ctx, config=config),