Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildsys, systemd: add unified-cgroup-hierarchy image feature #2845

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ARG VARIANT_FLAVOR
ARG REPO
ARG GRUB_SET_PRIVATE_VAR
ARG SYSTEMD_NETWORKD
ARG UNIFIED_CGROUP_HIERARCHY
ENV SYSTEMD_NETWORKD=${SYSTEMD_NETWORKD}
ENV VARIANT=${VARIANT}
WORKDIR /home/builder
Expand Down Expand Up @@ -102,6 +103,7 @@ RUN rpmdev-setuptree \
&& echo "%bcond_without $(V=${VARIANT_FLAVOR:-no}; V=${V,,}; echo ${V//-/_})_flavor" >> .bconds \
&& echo -e -n "${GRUB_SET_PRIVATE_VAR:+%bcond_without grub_set_private_var\n}" >> .bconds \
&& echo -e -n "${SYSTEMD_NETWORKD:+%bcond_without systemd_networkd\n}" >> .bconds \
&& echo -e -n "${UNIFIED_CGROUP_HIERARCHY:+%bcond_without unified_cgroup_hierarchy\n}" >> .bconds \
&& cat .bconds ${PACKAGE}.spec >> rpmbuild/SPECS/${PACKAGE}.spec \
&& find . -maxdepth 1 -not -path '*/\.*' -type f -exec mv {} rpmbuild/SOURCES/ \; \
&& echo ${NOCACHE}
Expand Down
1 change: 1 addition & 0 deletions packages/systemd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ path = "pkg.rs"

[package.metadata.build-package]
releases-url = "/~https://github.com/systemd/systemd-stable/releases"
package-features = ["unified-cgroup-hierarchy"]

[[package.metadata.build-package.external-files]]
url = "/~https://github.com/systemd/systemd-stable/archive/v250.9/systemd-stable-250.9.tar.gz"
Expand Down
4 changes: 4 additions & 0 deletions packages/systemd/systemd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ CONFIGURE_OPTS=(
-Dpkgconfigdatadir='%{_cross_pkgconfigdir}'
-Dpkgconfiglibdir='%{_cross_pkgconfigdir}'

%if %{with unified_cgroup_hierarchy}
-Ddefault-hierarchy=unified
%else
-Ddefault-hierarchy=hybrid
%endif

-Dadm-group=false
-Dwheel-group=false
Expand Down
13 changes: 13 additions & 0 deletions tools/buildsys/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ flag is meant primarily for development, and will be removed when development ha
[package.metadata.build-variant.image-features]
systemd-networkd = true
```

`unified-cgroup-hierarchy` makes systemd set up a unified cgroup hierarchy on
boot, i.e. the host will use cgroup v2 by default. This feature flag allows
old variants to continue booting with cgroup v1 and new variants to move to
cgroup v2, while users will still be able to override the default via command
line arguments set in the boot configuration.
```
[package.metadata.build-variant.image-features]
unified-cgroup-hierarchy = true
```
*/

mod error;
Expand Down Expand Up @@ -494,6 +504,7 @@ impl SupportedArch {
pub enum ImageFeature {
GrubSetPrivateVar,
SystemdNetworkd,
UnifiedCgroupHierarchy,
}

impl TryFrom<String> for ImageFeature {
Expand All @@ -502,6 +513,7 @@ impl TryFrom<String> for ImageFeature {
match s.as_str() {
"grub-set-private-var" => Ok(ImageFeature::GrubSetPrivateVar),
"systemd-networkd" => Ok(ImageFeature::SystemdNetworkd),
"unified-cgroup-hierarchy" => Ok(ImageFeature::UnifiedCgroupHierarchy),
_ => error::ParseImageFeatureSnafu { what: s }.fail()?,
}
}
Expand All @@ -512,6 +524,7 @@ impl fmt::Display for ImageFeature {
match self {
ImageFeature::GrubSetPrivateVar => write!(f, "GRUB_SET_PRIVATE_VAR"),
ImageFeature::SystemdNetworkd => write!(f, "SYSTEMD_NETWORKD"),
ImageFeature::UnifiedCgroupHierarchy => write!(f, "UNIFIED_CGROUP_HIERARCHY"),
}
}
}
Expand Down