]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: move code adding extra args for podman service to a func
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 29 Sep 2023 17:41:04 +0000 (13:41 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 18 Oct 2023 19:56:48 +0000 (15:56 -0400)
Move the code that checks for podman/podman features and adds extra args
based on that to a separate function. This more cleanly divides the
"business logic" from the mechanism of running a service container under
podman.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index 622b8aa41577c782ac0583a41d4e294e673f1eb0..175ecad7defc126fbfc74f6fa6fa83ce627c13f9 100755 (executable)
@@ -2801,6 +2801,25 @@ def get_container(
             f'--env-file={sg.conf_file_path}'
         )
 
+    _update_container_args_for_podman(ctx, ident, container_args)
+    return CephContainer.for_daemon(
+        ctx,
+        ident=ident,
+        entrypoint=entrypoint,
+        args=ceph_args + get_daemon_args(ctx, ident),
+        container_args=container_args,
+        volume_mounts=get_container_mounts(ctx, ident),
+        bind_mounts=get_container_binds(ctx, ident),
+        envs=envs,
+        privileged=privileged,
+        ptrace=ptrace,
+        host_network=host_network,
+    )
+
+
+def _update_container_args_for_podman(
+    ctx: CephadmContext, ident: DaemonIdentity, container_args: List[str]
+) -> None:
     # if using podman, set -d, --conmon-pidfile & --cidfile flags
     # so service can have Type=Forking
     if isinstance(ctx.container_engine, Podman):
@@ -2824,20 +2843,6 @@ def get_container(
         if not os.path.exists('/etc/hosts'):
             container_args.extend(['--no-hosts'])
 
-    return CephContainer.for_daemon(
-        ctx,
-        ident=ident,
-        entrypoint=entrypoint,
-        args=ceph_args + get_daemon_args(ctx, ident),
-        container_args=container_args,
-        volume_mounts=get_container_mounts(ctx, ident),
-        bind_mounts=get_container_binds(ctx, ident),
-        envs=envs,
-        privileged=privileged,
-        ptrace=ptrace,
-        host_network=host_network,
-    )
-
 
 def extract_uid_gid(ctx, img='', file_path='/var/lib/ceph'):
     # type: (CephadmContext, str, Union[str, List[str]]) -> Tuple[int, int]