]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add customize_container_mounts method to haproxy class
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 4 Nov 2023 23:18:24 +0000 (19:18 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Sat, 11 Nov 2023 13:10:49 +0000 (08:10 -0500)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py
src/cephadm/tests/test_ingress.py

index 83698a7f0be33e884e6e8a8ebb9f8c5ed24f7bb7..0ad3bb8b0192389458a0bca4fc8d57573d182970 100755 (executable)
@@ -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)
index d2bb7deb6eebed4dd2224ba94acfe50d2d016dac..7f23f64f51fc9253b5ac3294282f53d0ba07d34f 100644 (file)
@@ -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"