]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/ceph: allow cluster to be brought up with particular cephx key type
authorPatrick Donnelly <pdonnell@ibm.com>
Thu, 29 May 2025 16:11:22 +0000 (12:11 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 29 Dec 2025 22:31:58 +0000 (17:31 -0500)
For testing cephx upgrades from older key types.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
qa/tasks/ceph.py

index d4801c9b4ed86a50471ace1dbbf51cfc901e80a4..6899b11a252b987a0f54d99a1c1ea183acb04543 100644 (file)
@@ -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),