From: 胡玮文 Date: Thu, 11 Mar 2021 04:43:34 +0000 (+0800) Subject: cephadm: use split cgroup strategy for podman X-Git-Tag: v17.1.0~2369^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1a76f4793ec96045b0fed5cd85b1a6b3dbcd732c;p=ceph.git cephadm: use split cgroup strategy for podman Since systemd will create a cgroup for each service, we can instruct podman to just split the current cgroup into sub-cgroups. This enables system admins to use resource control features from systemd. Signed-off-by: 胡玮文 --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 2826652dcd0f..2682fc91c487 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -63,6 +63,7 @@ LOG_DIR_MODE = 0o770 DATA_DIR_MODE = 0o700 CONTAINER_INIT = True MIN_PODMAN_VERSION = (2, 0, 2) +CGROUPS_SPLIT_PODMAN_VERSION = (2, 1, 0) CUSTOM_PS1 = r'[ceph: \u@\h \W]\$ ' DEFAULT_TIMEOUT = None # in seconds DEFAULT_RETRY = 15 @@ -2457,6 +2458,8 @@ def get_container(ctx: CephadmContext, '--cidfile', runtime_dir + '/ceph-%s@%s.%s.service-cid' % (fsid, daemon_type, daemon_id), ]) + if ctx.container_engine.version >= CGROUPS_SPLIT_PODMAN_VERSION: + container_args.append('--cgroups=split') return CephContainer( ctx, @@ -2972,6 +2975,8 @@ def get_unit_file(ctx, fsid): 'ExecStopPost=-/bin/rm -f /%t/%n-pid /%t/%n-cid\n' 'Type=forking\n' 'PIDFile=/%t/%n-pid\n') + if ctx.container_engine.version >= CGROUPS_SPLIT_PODMAN_VERSION: + extra_args += 'Delegate=yes\n' docker = isinstance(ctx.container_engine, Docker) u = """# generated by cephadm