Skip to main content

ensure_host_container_parent

Function ensure_host_container_parent 

Source
pub fn ensure_host_container_parent() -> Option<String>
Expand description

Ensure the top-level host container hierarchy exists and has controllers delegated, returning the container parent path (/zlayer/containers, relative to the cgroup-v2 mount) for libcontainer’s cgroupsPath.

Only meaningful when the daemon can write the cgroup-v2 root (root host daemon — DaemonCapabilities::can_write_cgroup_root). Returns None on non-Linux, or when the mkdir fails (e.g. a read-only /sys/fs/cgroup), in which case callers fall back to in-scope placement.

Unlike ensure_daemon_leaf_and_container_parent, this does NOT migrate the daemon PID: with containers rooted outside the unit cgroup, the unit cgroup stays a clean leaf that systemd can always re-attach to on restart, so no init leaf split is needed.