Skip to content

Commit 621e108

Browse files
cephadm: move code adding extra args for podman service to a func
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 <[email protected]>
1 parent 86422b6 commit 621e108

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/cephadm/cephadm.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,6 +2801,25 @@ def get_container(
28012801
f'--env-file={sg.conf_file_path}'
28022802
)
28032803

2804+
_update_container_args_for_podman(ctx, ident, container_args)
2805+
return CephContainer.for_daemon(
2806+
ctx,
2807+
ident=ident,
2808+
entrypoint=entrypoint,
2809+
args=ceph_args + get_daemon_args(ctx, ident),
2810+
container_args=container_args,
2811+
volume_mounts=get_container_mounts(ctx, ident),
2812+
bind_mounts=get_container_binds(ctx, ident),
2813+
envs=envs,
2814+
privileged=privileged,
2815+
ptrace=ptrace,
2816+
host_network=host_network,
2817+
)
2818+
2819+
2820+
def _update_container_args_for_podman(
2821+
ctx: CephadmContext, ident: DaemonIdentity, container_args: List[str]
2822+
) -> None:
28042823
# if using podman, set -d, --conmon-pidfile & --cidfile flags
28052824
# so service can have Type=Forking
28062825
if isinstance(ctx.container_engine, Podman):
@@ -2824,20 +2843,6 @@ def get_container(
28242843
if not os.path.exists('/etc/hosts'):
28252844
container_args.extend(['--no-hosts'])
28262845

2827-
return CephContainer.for_daemon(
2828-
ctx,
2829-
ident=ident,
2830-
entrypoint=entrypoint,
2831-
args=ceph_args + get_daemon_args(ctx, ident),
2832-
container_args=container_args,
2833-
volume_mounts=get_container_mounts(ctx, ident),
2834-
bind_mounts=get_container_binds(ctx, ident),
2835-
envs=envs,
2836-
privileged=privileged,
2837-
ptrace=ptrace,
2838-
host_network=host_network,
2839-
)
2840-
28412846

28422847
def extract_uid_gid(ctx, img='', file_path='/var/lib/ceph'):
28432848
# type: (CephadmContext, str, Union[str, List[str]]) -> Tuple[int, int]

0 commit comments

Comments
 (0)