services: rootless-podman: Enable I/O delegation.

Based on
https://rootlesscontaine.rs/getting-started/common/cgroup2/#enabling-cpu-cpuset-and-io-delegation
, this patch enables I/O delegation for cgroups v2 enabled users.

* gnu/services/containers.scm (cgroups-limits-entrypoint): Enable I/O
controller delegation.
* gnu/tests/containers.scm: Test it.

Change-Id: I7caba33695f11830bea477c4ab3afb89cfaa2fa5
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Giacomo Leidi 2025-01-06 22:05:52 +01:00 committed by Ludovic Courtès
parent b7746ad83f
commit 24a12aeb91
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 2 additions and 2 deletions

View file

@ -174,7 +174,7 @@ (define cgroups-limits-entrypoint
#~(system* #~(system*
(string-append #+bash-minimal "/bin/bash") "-c" (string-append #+bash-minimal "/bin/bash") "-c"
(string-append "echo Setting cgroups v2 limits && " (string-append "echo Setting cgroups v2 limits && "
"echo +cpu +cpuset +memory +pids" "echo +cpu +cpuset +io +memory +pids"
" >> /sys/fs/cgroup/cgroup.subtree_control")))) " >> /sys/fs/cgroup/cgroup.subtree_control"))))
(define (rootless-podman-cgroups-limits-service config) (define (rootless-podman-cgroups-limits-service config)

View file

@ -158,7 +158,7 @@ (define slurp
(loop (+ 1 attempts)))))))) (loop (+ 1 attempts))))))))
(test-equal "/sys/fs/cgroup/cgroup.subtree_control content is sound" (test-equal "/sys/fs/cgroup/cgroup.subtree_control content is sound"
(list "cpu" "cpuset" "memory" "pids") (list "cpu" "cpuset" "io" "memory" "pids")
(marionette-eval (marionette-eval
`(begin `(begin
(use-modules (srfi srfi-1) (use-modules (srfi srfi-1)