Skip to content

Commit

Permalink
libcrun: deprecate cgroup v1
Browse files Browse the repository at this point in the history
we are two months away from 2025, cgroup v1 should not be used
anymore.

For now, add a warning when cgroup v1 is used.

Closes: containers#1149

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Oct 28, 2024
1 parent 0cf2e6c commit ef60ec9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crun.1
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,11 @@ additional id specified in the files \fB/etc/subuid\fR and \fB/etc/subgid\fR
is automatically added starting with ID 1.


.SH CGROUP v1
.PP
Support for cgroup v1 is deprecated and will be removed in a future release.


.SH CGROUP v2
.PP
\fBNote\fP: cgroup v2 does not yet support control of realtime processes and
Expand Down
4 changes: 4 additions & 0 deletions crun.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,10 @@ The current user is mapped to the ID 0 in the container, and any
additional id specified in the files `/etc/subuid` and `/etc/subgid`
is automatically added starting with ID 1.

# CGROUP v1

Support for cgroup v1 is deprecated and will be removed in a future release.

# CGROUP v2

**Note**: cgroup v2 does not yet support control of realtime processes and
Expand Down
8 changes: 8 additions & 0 deletions src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -2365,6 +2365,14 @@ libcrun_container_run_internal (libcrun_container_t *container, libcrun_context_
struct libcrun_dirfd_s cgroup_dirfd_s;
struct libcrun_seccomp_gen_ctx_s seccomp_gen_ctx;
const char *seccomp_bpf_data = find_annotation (container, "run.oci.seccomp_bpf_data");
int cgroup_mode;

cgroup_mode = libcrun_get_cgroup_mode (err);
if (UNLIKELY (cgroup_mode < 0))
return cgroup_mode;

if (cgroup_mode != CGROUP_MODE_UNIFIED)
libcrun_warning ("cgroup v1 is deprecated and will be removed in a future release. Use cgroup v2");

if (def->hooks
&& (def->hooks->prestart_len || def->hooks->poststart_len || def->hooks->create_runtime_len
Expand Down

0 comments on commit ef60ec9

Please sign in to comment.