From 7817a6f4292cf283a119d7f5de57832594482e59 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Sat, 4 Nov 2023 19:18:24 -0400 Subject: [PATCH] cephadm: add customize_container_mounts method to haproxy class Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 12 +++++++++--- src/cephadm/tests/test_ingress.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 83698a7f0be..0ad3bb8b019 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1576,11 +1576,17 @@ class HAproxy(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, 'haproxy')] = '/var/lib/haproxy' 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)) + @staticmethod def get_sysctl_settings() -> List[str]: return [ @@ -2698,8 +2704,8 @@ def get_container_mounts( mounts.update(nfs_ganesha.get_container_mounts(data_dir)) if daemon_type == HAproxy.daemon_type: - data_dir = ident.data_dir(ctx.data_dir) - mounts.update(HAproxy.get_container_mounts(data_dir)) + haproxy = HAproxy.create(ctx, ident) + haproxy.customize_container_mounts(ctx, mounts) if daemon_type == CephNvmeof.daemon_type: nvmeof = CephNvmeof.create(ctx, ident) diff --git a/src/cephadm/tests/test_ingress.py b/src/cephadm/tests/test_ingress.py index d2bb7deb6ee..7f23f64f51f 100644 --- a/src/cephadm/tests/test_ingress.py +++ b/src/cephadm/tests/test_ingress.py @@ -90,7 +90,7 @@ def test_haproxy_container_mounts(): good_haproxy_json(), SAMPLE_HAPROXY_IMAGE, ) - cmounts = hap.get_container_mounts("/var/tmp") + cmounts = hap._get_container_mounts("/var/tmp") assert len(cmounts) == 1 assert cmounts["/var/tmp/haproxy"] == "/var/lib/haproxy" -- 2.39.5