overlay

package
v0.9.299 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package overlay provides shared helpers for restoring a container's overlayfs RW (upper) layer from a dump.

It lives in the parent module so that runc plugin, the containerd plugin, and the containerd runtime shim (cedana-containerd-runtime) can all use it.

The Linux overlayfs contract states that modifying the underlying upper/lower directories of a *mounted* overlay is undefined behavior Therefore the RW layer must be restored into the upperdir *before* the overlay is mounted:

  • Kubernetes pods: the containerd shim (cedana-containerd-runtime) populates the upperdir just before it mounts the rootfs.
  • CLI `cedana restore`: the containerd plugin populates the freshly-prepared snapshot's upperdir before NewTask mounts it.

Both drop a marker so the runc plugin's post-mount restore is a no-op.

Index

Constants

View Source
const RestoredMarker = ".cedana-rw-restored"

RestoredMarker is dropped in the snapshot directory (the parent of the upperdir, which is outside the overlay's merged view and therefore invisible to the container) once the RW layer has been restored. Its presence tells a later, redundant restore attempt to skip and avoid a double-populate.

Variables

This section is empty.

Functions

func AlreadyRestored

func AlreadyRestored(upperDir string) bool

func MarkerPath

func MarkerPath(upperDir string) string

func RestoreToUpperDir

func RestoreToUpperDir(ctx context.Context, dump afero.Fs, upperDir string) (err error)

RestoreToUpperDir reads the RW-layer batches from the dump filesystem and writes them into upperDir. No-op if dump has no RW-layer manifest

func UpperDirFromMountOptions

func UpperDirFromMountOptions(options []string) (string, error)

UpperDirFromMountOptions extracts the upperdir from a set of overlay mount options

func WriteMarker

func WriteMarker(upperDir string) error

WriteMarker records that the RW layer for the given upperdir has been restored.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL