From: John Mulligan Date: Fri, 20 Oct 2023 18:57:50 +0000 (-0400) Subject: cephadm: add customize_container_mounts method to iscsi class X-Git-Tag: v19.0.0~92^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fe0ed1c541bf47f3fd1bcd2eb69e1ae2e2e19afb;p=ceph.git cephadm: add customize_container_mounts method to iscsi class Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 95cf15ea5659..88f26e2abff2 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1075,7 +1075,7 @@ class CephIscsi(ContainerDaemonForm): return DaemonIdentity(self.fsid, self.daemon_type, self.daemon_id) @staticmethod - def get_container_mounts(data_dir, log_dir): + def _get_container_mounts(data_dir, log_dir): # type: (str, str) -> Dict[str, str] mounts = dict() mounts[os.path.join(data_dir, 'config')] = '/etc/ceph/ceph.conf:z' @@ -1087,6 +1087,17 @@ class CephIscsi(ContainerDaemonForm): mounts['/dev'] = '/dev' return mounts + def customize_container_mounts( + self, ctx: CephadmContext, mounts: Dict[str, str] + ) -> None: + data_dir = self.identity.data_dir(ctx.data_dir) + # Removes ending ".tcmu" from data_dir a tcmu-runner uses the same + # data_dir as rbd-runner-api + if data_dir.endswith('.tcmu'): + data_dir = re.sub(r'\.tcmu$', '', data_dir) + log_dir = get_log_dir(self.identity.fsid, ctx.log_dir) + mounts.update(CephIscsi._get_container_mounts(data_dir, log_dir)) + def customize_container_binds( self, ctx: CephadmContext, binds: List[List[str]] ) -> None: @@ -1239,7 +1250,6 @@ done def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]: return extract_uid_gid(ctx) - ################################## @@ -2684,13 +2694,8 @@ def get_container_mounts( mounts.update(CephNvmeof.get_container_mounts(data_dir)) if daemon_type == CephIscsi.daemon_type: - data_dir = ident.data_dir(ctx.data_dir) - # Removes ending ".tcmu" from data_dir a tcmu-runner uses the same data_dir - # as rbd-runner-api - if data_dir.endswith('.tcmu'): - data_dir = re.sub(r'\.tcmu$', '', data_dir) - log_dir = get_log_dir(fsid, ctx.log_dir) - mounts.update(CephIscsi.get_container_mounts(data_dir, log_dir)) + iscsi = CephIscsi.create(ctx, ident) + iscsi.customize_container_mounts(ctx, mounts) if daemon_type == Keepalived.daemon_type: data_dir = ident.data_dir(ctx.data_dir)