]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add a data_dir method to DaemonIdentity
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 12 Sep 2023 18:22:25 +0000 (14:22 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 14 Sep 2023 15:29:47 +0000 (11:29 -0400)
This will replace `get_data_dir` in a future commit.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadmlib/daemon_identity.py

index f7e958ebf748c300fe0968d02af40221c3429c91..7fc4af1cb77112c59e8785d82244183d60c3166b 100644 (file)
@@ -1,5 +1,7 @@
 # deamon_identity.py - classes for identifying daemons & services
 
+import os
+import pathlib
 import re
 
 from typing import Union
@@ -50,6 +52,9 @@ class DaemonIdentity:
     def unit_name(self) -> str:
         return f'ceph-{self.fsid}@{self.daemon_type}.{self.daemon_id}'
 
+    def data_dir(self, base_data_dir: Union[str, os.PathLike]) -> str:
+        return str(pathlib.Path(base_data_dir) / self.fsid / self.daemon_name)
+
     @classmethod
     def from_name(cls, fsid: str, name: str) -> 'DaemonIdentity':
         daemon_type, daemon_id = name.split('.', 1)