cgroups-rs exposes oci-spec types in its public API (e.g.
Manager::set() takes &LinuxResources), so the version pinned here
dictates which oci-spec version every consumer must use: 0.x lines
are semver-incompatible, and a consumer on a newer oci-spec gets
"expected LinuxResources, found LinuxResources" type mismatches.
Kata Containers is moving its workspace to oci-spec 0.10.0 and
cannot call into cgroups-rs until this crate follows. The 0.8 to
0.10 changes are additive for everything cgroups-rs touches (no
code changes needed): the crate builds warning-free with the oci
feature and the unit tests pass (the only failures are the
pre-existing fs manager tests that need root to write cgroupfs).
Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
Assisted-by: Claude Fable 5 <noreply@anthropic.com>
The tests cover the methods of `conv` mod, `FsManager`, and
`SystemdManager`. Since we have to manipulate the cgroups during testing,
the tests related to this part are set to be run in sequence.
Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
The tests cover `SystemdClient` and methods from `utils` mods.
Please note that the `SystemdClient` tests do not run well in parallel, but
work well in sequence. Please run them with `--test-threads=1`.
Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
`SystemdCgroup` takes a `parent`, which is the name of a slice, and a
`unit`, which is the name of a slice or a scope unit, and provides methods
to start, kill the unit, as well as set properties for the unit.
The mods, `cpu`, `memory`, `cpuset`, and `pids`, are designed to generate
properties quickly. It hides the difference between cgroups v1 and v2, and
does simple checks for the systemd version and arguments.
Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
`Manager` is a trait to unify the interface of cgroups. It is designed for
OCI containers. Its `set()` takes Linux resources of the OCI spec to set
cgroups.
The `FsManager`, the concrete implementation of `Manager`, manipulates
cgroups through cgroupfs, and supports both cgroups v1 and v2.
Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This removes the only place the regex crate is used, which could lead to significant binary size savings in projects that don't use the regex craate.
Signed-off-by: Oguz Bilgener <oguz@bilgener.me>
There are several fixes since the last release, and itś been a few years
waiting for a new one.
Signed-off-by: Fabiano Fidêncio <fidencio@northflank.com>
The included patches are
- 89edba0f85: gha: Bump Rust version to 1.69.0
- 66a93b1c3d: devices: Throw an error if device resources are invalid
- 55505e0b3e: Minor changes for cgroup and devices subsystem
- 0b6b229a38: add .path() method
Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
For some cgroup file operations, when failed, add the path
and the value (for write operation) to the error message.
Fixes: #93
Signed-off-by: bin liu <liubin0329@gmail.com>
Add feature "serde" that derives all resource and statistics types from
Serialize and Deserialize. The feature is turned off by default.
Fixes#54Fixes#55Fixes#56
Signed-off-by: Felix Obenhuber <felix@obenhuber.de>
Delete check_support and stop detecting subsystems by finding in the
root folders because the detecting method is not accurate.
Signed-off-by: Tim Zhang <tim@hyper.sh>