buildsys, systemd: add unified-cgroup-hierarchy image feature #2845
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue number:
#2843
Description of changes:
Add a new image feature toggle
unified-cgroup-hierarchy
. The image feature allows variants to select either cgroup v1 or cgroup v2 (the "unified cgroup hierarchy") as the default for systemd to set up during host boot.The image feature changes how systemd is configured at build time. This results in slightly differing builds of systemd depending on variants' selected image features. Users can still override the default choice via a command line argument (
systemd.unified_cgroup_hierarchy=[01]
) supplied via the user data and boot config mechanisms.Alternatively, the default cgroup version to use could be selected by baking a command line argument into the image. However, this would present a liability since GRUB and its configuration are not being updated during image updates, and some hosts would be stuck with it forever. Whether a user could override this setting via their own command line arguments would come down to parsing logic handles duplicate settings and seems brittle, especially when trying to provide guarantees "forever".
Testing done:
variants/metal-dev/Cargo.toml
to carryunified-cgroup-hierarchy = true
in thepackage.metadata.build-variant.image-features]
sectionmetal-dev
variantmount | grep cgroup
output and only finding a singlecgroup2
mountmetal-dev
variant to confirm the systemd build is cached if the image feature flag doesn't changeaws-dev
variant to confirm systemd and dependent packages get rebuilt if the image feature flag changesReviewer notes:
This does not yet make any variant actually default to cgroup v2, but only provides the means to do so. This is still pending version 0.10.0 of the admin container getting deployed, which carries changes to make it work on cgroup v2 hosts.
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.