]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: add customize_container_mounts method to keepalived class
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 20 Oct 2023 19:03:11 +0000 (15:03 -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 fe67904d800f142c430664e26dad68e79fae328f..83698a7f0be33e884e6e8a8ebb9f8c5ed24f7bb7 100755 (executable)
@@ -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)
index 698305aa4f38dccc202eabd8651a1664eb5f6fe7..d2bb7deb6eebed4dd2224ba94acfe50d2d016dac 100644 (file)
@@ -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"]