]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: move some podman specific mount logic to podman class
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 21 Oct 2023 15:28:30 +0000 (11:28 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 6 Nov 2023 16:02:02 +0000 (11:02 -0500)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py
src/cephadm/cephadmlib/container_engines.py

index c56bd6bc2a2caa6d8d3e09e6201f2b8e80a2a63b..641b269c1324d7b0bb114f27b640bbc6e641db73 100755 (executable)
@@ -2647,17 +2647,8 @@ def get_container_mounts(
 
 def _update_podman_mounts(ctx: CephadmContext, mounts: Dict[str, str]) -> None:
     """Update the given mounts dict with mounts specific to podman."""
-    # Modifications podman makes to /etc/hosts causes issues with
-    # certain daemons (specifically referencing "host.containers.internal" entry
-    # being added to /etc/hosts in this case). To avoid that, but still
-    # allow users to use /etc/hosts for hostname resolution, we can
-    # mount the host's /etc/hosts file.
-    # https://tracker.ceph.com/issues/58532
-    # https://tracker.ceph.com/issues/57018
     if isinstance(ctx.container_engine, Podman):
-        if os.path.exists('/etc/hosts'):
-            if '/etc/hosts' not in mounts:
-                mounts['/etc/hosts'] = '/etc/hosts:ro'
+        ctx.container_engine.update_mounts(ctx, mounts)
 
 
 def get_ceph_volume_container(ctx: CephadmContext,
index 99d64ff015cbaa43470cfcb358f4147387e9f22b..8ced8ab3ff4b430131045d14ebb3d23479631646 100644 (file)
@@ -2,7 +2,7 @@
 
 import os
 
-from typing import Tuple, List, Optional
+from typing import Tuple, List, Optional, Dict
 
 from .call_wrappers import call_throws, CallVerbosity
 from .context import CephadmContext
@@ -78,6 +78,21 @@ class Podman(ContainerEngine):
             args.append('--no-hosts')
         return args
 
+    def update_mounts(
+        self, ctx: CephadmContext, mounts: Dict[str, str]
+    ) -> None:
+        """Update mounts adding entries that are specific to podman."""
+        # Modifications podman makes to /etc/hosts causes issues with certain
+        # daemons (specifically referencing "host.containers.internal" entry
+        # being added to /etc/hosts in this case). To avoid that, but still
+        # allow users to use /etc/hosts for hostname resolution, we can mount
+        # the host's /etc/hosts file.
+        # https://tracker.ceph.com/issues/58532
+        # https://tracker.ceph.com/issues/57018
+        if os.path.exists('/etc/hosts'):
+            if '/etc/hosts' not in mounts:
+                mounts['/etc/hosts'] = '/etc/hosts:ro'
+
 
 class Docker(ContainerEngine):
     EXE = 'docker'