]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: convert _write_osd_unit_run_commands to to use a DaemonIdentity argument
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 27 Jul 2023 00:00:01 +0000 (20:00 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 11 Sep 2023 19:23:04 +0000 (15:23 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index a9b28bc491808d4b58b9ed0676c077104ccbdd6a..6e2a0eae5cbcd7768bbe2f5c5c482d40952fa233 100755 (executable)
@@ -3110,7 +3110,9 @@ def deploy_daemon_units(
         # pre-start cmd(s)
         if daemon_type == 'osd':
             assert osd_fsid
-            _write_osd_unit_run_commands(ctx, f, daemon_type, str(daemon_id), fsid, osd_fsid, data_dir, uid, gid)
+            _write_osd_unit_run_commands(
+                ctx, f, ident, osd_fsid, data_dir, uid, gid
+            )
         elif daemon_type == CephIscsi.daemon_type:
             _write_iscsi_unit_run_commands(ctx, f, daemon_type, str(daemon_id), fsid, data_dir)
         init_containers = init_containers or []
@@ -3191,9 +3193,7 @@ def _write_stop_actions(
 def _write_osd_unit_run_commands(
     ctx: CephadmContext,
     f: IO,
-    daemon_type: str,
-    daemon_id: str,
-    fsid: str,
+    ident: 'DaemonIdentity',
     osd_fsid: str,
     data_dir: str,
     uid: int,
@@ -3201,7 +3201,7 @@ def _write_osd_unit_run_commands(
 ) -> None:
     # osds have a pre-start step
     simple_fn = os.path.join('/etc/ceph/osd',
-                             '%s-%s.json.adopted-by-cephadm' % (daemon_id, osd_fsid))
+                             '%s-%s.json.adopted-by-cephadm' % (ident.daemon_id, osd_fsid))
     if os.path.exists(simple_fn):
         f.write('# Simple OSDs need chown on startup:\n')
         for n in ['block', 'block.db', 'block.wal']:
@@ -3210,7 +3210,9 @@ def _write_osd_unit_run_commands(
     else:
         # if ceph-volume does not support 'ceph-volume activate', we must
         # do 'ceph-volume lvm activate'.
-        ident = DaemonIdentity(fsid, daemon_type, daemon_id)
+        fsid = ident.fsid
+        daemon_type = ident.daemon_type
+        daemon_id = ident.daemon_id
         test_cv = get_ceph_volume_container(
             ctx,
             args=['activate', '--bad-option'],
@@ -3237,7 +3239,6 @@ def _write_osd_unit_run_commands(
                 '--no-tmpfs',
             ]
 
-        ident = DaemonIdentity(fsid, daemon_type, daemon_id)
         prestart = get_ceph_volume_container(
             ctx,
             args=cmd,