Skip to content

Conversation

justxuewei
Copy link
Member

@justxuewei justxuewei commented Aug 5, 2025

manager: Make FsManager and SystemdManager serializable

The kata-agent (de)serializes managers in child initialization. The oci
feature relies on serde crate to provide the ability to serialize.

Zbus's value uses variable reference, which is hard to serialize. Value
is introduced to take the ownership of the value, so that we can remove
lifetime annotations from SystemdClient, also from SystemdManager.

The types supported by the Value only include the types that are in use.
Later on, more types can be added to Value if needed.

manager: Add Debug trait for Manager

Both FsManager and SystemdManger support Debug trait, so we can add
it to Manager as well.

cgroups-rs: Enhance CgroupPid

Implement From<u32> and From<i32> for CgroupPid to allow conversion
from these types directly. Add as_raw() method to retrieve the raw PID
value, and add set() method to modify the PID value.

manager: Make create_cgroups() public

The kata-agent expects to create sandbox cgroup without need to wait for
the first process/thread to be added to the cgroup.

manager: Add devices cgroup stats

The stats allow users to retrieve device whitelist from the cgroupfs.

manager: Skip resources whose controller doesn't exist

Not all cgroup controllers are available, so we should skip setting cgroups
for those controllers.

The kata-agent (de)serializes managers in child initialization. The `oci`
feature relies on `serde` crate to provide the ability to serialize.

Zbus's value uses variable reference, which is hard to serialize. `Value`
is introduced to take the ownership of the value, so that we can remove
lifetime annotations from `SystemdClient`, also from `SystemdManager`.

The types supported by the `Value` only include the types that are in use.
Later on, more types can be added to `Value` if needed.

Signed-off-by: Xuewei Niu <[email protected]>
Both `FsManager` and `SystemdManger` support `Debug` trait, so we can add
it to `Manager` as well.

Signed-off-by: Xuewei Niu <[email protected]>
Implement `From<u32>` and `From<i32>` for `CgroupPid` to allow conversion
from these types directly. Add `as_raw()` method to retrieve the raw PID
value, and add `set()` method to modify the PID value.

Signed-off-by: Xuewei Niu <[email protected]>
The kata-agent expects to create sandbox cgroup without need to wait for
the first process/thread to be added to the cgroup.

Signed-off-by: Xuewei Niu <[email protected]>
The stats allow users to retrieve device whitelist from the cgroupfs.

Signed-off-by: Xuewei Niu <[email protected]>
Not all cgroup controllers are available, so we should skip setting cgroups
for those controllers.

Signed-off-by: Xuewei Niu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant