conf: make cgroup delegate and leaf name first-class keys

parse_cgroup() takes two arguments that are not cgroupfs files: the
leaf directory to place the service in, and whether to hand the subtree
over to it.  The block format could express neither.  'name' happened
to work, because a free-form key is emitted as name:VALUE and that is
what the parser looks for, but 'delegate' came out as delegate:true and
was filed as a cgroup setting, so it silently did nothing.

Declare both, and emit delegate as the bare flag the parser expects.
Neither means anything on a top-level group definition, so say so there
rather than emitting something that would be written to cgroupfs.

    service podman {
        cgroup containers { name = "podman"  delegate = true }
        ...
    }

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-07-30 15:21:30 +02:00
parent ddaef0600f
commit ecac1e58e3
2 changed files with 46 additions and 3 deletions
+17
View File
@@ -257,3 +257,20 @@ for key in manual-start manual; do
run "initctl stop service.sh"
retry 'assert_num_children 0 service.sh'
done
# delegate is a flag to parse_cgroup(), not a cgroupfs file, and the
# cgroup leaf name is an argument too. Both must come out of the
# translator in the comma-separated form that parser expects.
say 'cgroup delegate and name translate as parse_cgroup arguments'
run "echo 'service service.sh {' > $FINIT_CONF"
run "echo ' description = \"Delegated\"' >> $FINIT_CONF"
run "echo ' cgroup system {' >> $FINIT_CONF"
run "echo ' name = \"mysvc\"' >> $FINIT_CONF"
run "echo ' delegate = true' >> $FINIT_CONF"
run "echo ' cpu.weight = 250' >> $FINIT_CONF"
run "echo ' }' >> $FINIT_CONF"
run "echo ' command = \"service.sh\"' >> $FINIT_CONF"
run "echo '}' >> $FINIT_CONF"
run "initctl reload"
retry 'assert_desc "Delegated" service.sh'