]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cepahdm: avoid subclass related issues for data_dir
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 17 Nov 2023 20:45:55 +0000 (15:45 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 2 Jan 2024 14:30:20 +0000 (09:30 -0500)
Do not have data dir depend on the daemon_name property. This property
is overriden by the subclass(es) but we want DaemonIdentities and
DaemonSubIdentities to share the same data_dir.

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

index f13473c2a23992f98483d3f67de26e0f0e8bf79b..4114cdf1b59745f682bacfa6bf5d6c8cd39ee1d7 100644 (file)
@@ -93,7 +93,9 @@ class DaemonIdentity:
         return self._systemd_name(category='init', extension='service')
 
     def data_dir(self, base_data_dir: Union[str, os.PathLike]) -> str:
-        return str(pathlib.Path(base_data_dir) / self.fsid / self.daemon_name)
+        # do not use self.daemon_name as that may be overridden in subclasses
+        dn = f'{self.daemon_type}.{self.daemon_id}'
+        return str(pathlib.Path(base_data_dir) / self.fsid / dn)
 
     @classmethod
     def from_name(cls, fsid: str, name: str) -> 'DaemonIdentity':