From: John Mulligan Date: Fri, 20 Oct 2023 19:03:11 +0000 (-0400) Subject: cephadm: add customize_container_mounts method to keepalived class X-Git-Tag: v19.0.0~92^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f76822a15ec813e6268da36c0ae40e7b259eec9f;p=ceph.git cephadm: add customize_container_mounts method to keepalived class Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index fe67904d800f..83698a7f0be3 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1697,11 +1697,17 @@ class Keepalived(ContainerDaemonForm): return extract_uid_gid(self.ctx, file_path='/var/lib') @staticmethod - def get_container_mounts(data_dir: str) -> Dict[str, str]: + def _get_container_mounts(data_dir: str) -> Dict[str, str]: mounts = dict() mounts[os.path.join(data_dir, 'keepalived.conf')] = '/etc/keepalived/keepalived.conf' return mounts + def customize_container_mounts( + self, ctx: CephadmContext, mounts: Dict[str, str] + ) -> None: + data_dir = self.identity.data_dir(ctx.data_dir) + mounts.update(self._get_container_mounts(data_dir)) + def container(self, ctx: CephadmContext) -> CephContainer: ctr = get_container(ctx, self.identity) return to_deployment_container(ctx, ctr) @@ -2704,8 +2710,8 @@ def get_container_mounts( iscsi.customize_container_mounts(ctx, mounts) if daemon_type == Keepalived.daemon_type: - data_dir = ident.data_dir(ctx.data_dir) - mounts.update(Keepalived.get_container_mounts(data_dir)) + keepalive = Keepalived.create(ctx, ident) + keepalive.customize_container_mounts(ctx, mounts) if daemon_type == CustomContainer.daemon_type: cc = CustomContainer.create(ctx, ident) diff --git a/src/cephadm/tests/test_ingress.py b/src/cephadm/tests/test_ingress.py index 698305aa4f38..d2bb7deb6eeb 100644 --- a/src/cephadm/tests/test_ingress.py +++ b/src/cephadm/tests/test_ingress.py @@ -244,7 +244,7 @@ def test_keepalived_container_mounts(): good_keepalived_json(), SAMPLE_KEEPALIVED_IMAGE, ) - cmounts = kad.get_container_mounts("/var/tmp") + cmounts = kad._get_container_mounts("/var/tmp") assert len(cmounts) == 1 assert ( cmounts["/var/tmp/keepalived.conf"]