pub struct RootfsBuilder { /* private fields */ }Expand description
Builds sandbox rootfs images; see the module docs.
Implementations§
Source§impl RootfsBuilder
impl RootfsBuilder
Sourcepub fn new(paths: RootfsPaths, block_tools: Arc<dyn BlockTools>) -> Self
pub fn new(paths: RootfsPaths, block_tools: Arc<dyn BlockTools>) -> Self
A builder over paths, mounting through block_tools.
Sourcepub fn paths(&self) -> &RootfsPaths
pub fn paths(&self) -> &RootfsPaths
The paths this builder was composed with.
Source§impl RootfsBuilder
impl RootfsBuilder
Sourcepub async fn convert_layer_to_rootfs(
&self,
layer_path: &str,
pinned: &BTreeSet<PathBuf>,
) -> Result<String>
pub async fn convert_layer_to_rootfs( &self, layer_path: &str, pinned: &BTreeSet<PathBuf>, ) -> Result<String>
Convert an image source directory to a bootable ext4 rootfs.
layer_path is a directory: either an OCI image layout staged by the
host CLI (the --from-image / --from-dockerfile path) or a Docker
overlay2 chain-id directory (e.g. /var/lib/docker/overlay2/<chain-id>).
pinned are images that must survive the superseded-image sweep
because a snapshot still needs them as its dm-snapshot origin
(SandboxManager::pinned_rootfs_paths).
Returns the path to the generated (or cached) ext4 image.
Source§impl RootfsBuilder
impl RootfsBuilder
Sourcepub async fn sweep_stale_tmp(&self)
pub async fn sweep_stale_tmp(&self)
Remove leftover *.ext4.tmp build artifacts from the rootfs cache dir.
A rootfs build that crashed or panicked leaves a .default-<uuid>.ext4.tmp
or .rootfs-<id>.ext4.tmp (each up to the image size) with no owner;
sweep them at startup so repeated failures don’t accrue disk usage.
Sourcepub async fn ensure_default_rootfs(&self, path: &str) -> Result<()>
pub async fn ensure_default_rootfs(&self, path: &str) -> Result<()>
Ensure the default busybox + vm-agent rootfs exists at path and is
newer than its source binaries. Returns without touching the image
when it is already up to date.