mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 13:02:37 +07:00
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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user