]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: use split cgroup strategy for podman 40025/head
author胡玮文 <huww98@outlook.com>
Thu, 11 Mar 2021 04:43:34 +0000 (12:43 +0800)
committer胡玮文 <huww98@outlook.com>
Sat, 20 Mar 2021 16:33:08 +0000 (00:33 +0800)
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: 胡玮文 <huww98@outlook.com>
src/cephadm/cephadm

index 2826652dcd0fc58f8baed2b2b1fcdb183a8b2770..2682fc91c487accb30c9ecec0e106fd1f161d79b 100755 (executable)
@@ -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