storagemigration

package
v20.10.44+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

TODO: do we need to handle .wh..wh.plnk layer hardlinks?

Package storagemigration

migrates images and containers from `aufs` to `overlay2` storage-driver

To enable safe rollback, no breaking changes are applied to the real storage locations until we are done. The overlay2 tree is built in a temporary location: `/var/lib/balena-engine/overlay2.temp` and moved on completion.

We use hardlinks to "duplicate" the layer data. This ensures we have a rollback path at the cost of ~2x the inode count.

Index

Constants

View Source
const (
	// MetaOpaque means the directory should appear empty
	MetaOpaque = iota
	// MetaWhiteout means the file should not appear
	MetaWhiteout

	// MetaOther is a catch-all for everything else
	MetaOther
)

Variables

This section is empty.

Functions

func AppendLower

func AppendLower(lower, parentID string) string

AppendLower adds parentID to the list of lower directories written to /:layer_id/lower

func CreateLayerLink(root, layerID string) (layerRef string, err error)

CreateLayerLink creates a link file in the layer root dir and a corresponding file in the l directory The returned layerRef is the content of the created link file

func GetParentIDs

func GetParentIDs(root, id string) ([]string, error)

Read the layers file for the current id and return all the layers represented by new lines in the file

If there are no lines in the file then the id has no parent and an empty slice is returned.

from daemon/graphdriver/aufs/dirs.go

func IsOpaqueParentDir

func IsOpaqueParentDir(filename string) bool

func IsWhiteout

func IsWhiteout(filename string) bool

func IsWhiteoutMeta

func IsWhiteoutMeta(filename string) bool

func LoadIDs

func LoadIDs(root string) ([]string, error)

Return all the directories

from daemon/graphdriver/aufs/dirs.go

func Migrate

func Migrate(root string) (err error)

Migrate migrates the state of the storage from aufs -> overlay2

func SetOpaque

func SetOpaque(path string) error

SetOpaque marks the directory to appera empty by setting the xattr "trusted.overlay.opaque" to "y"

func SetWhiteout

func SetWhiteout(path string) error

SetWhiteout marks the file as deleted by creating a character device with 0/0 device number

func StripWhiteoutPrefix

func StripWhiteoutPrefix(filename string) string

func SwitchAllContainersStorageDriver

func SwitchAllContainersStorageDriver(root, newStorageDriver string) error

SwitchAllContainersStorageDriver iterates over all containers and configures them to use `newStorageDriver`.

Types

type Layer

type Layer struct {
	ID        string
	ParentIDs []string
	Meta      []Meta
}

Layer is a single layer of an image

type Meta

type Meta struct {
	Type MetaType
	// Path is the path to the affected file/dir
	Path string
}

Meta is extra data to make a layered FS work The information contained should enable reconstruction of metadata on both aufs and overlay

type MetaType

type MetaType int

MetaType describes the type of metadata

type State

type State struct {
	Layers []Layer
}

State models the state of the aufs/overlay2 directory

Jump to

Keyboard shortcuts

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