package layers

import "github.com/Microsoft/hcsshim/internal/layers"

Package layers deals with container layer mounting/unmounting for LCOW and WCOW

Index

Functions

func GetHCSLayers

func GetHCSLayers(ctx context.Context, vm *uvm.UtilityVM, paths []string) (layers []hcsschema.Layer, err error)

GetHCSLayers converts host paths corresponding to container layers into HCS schema V2 layers

func MountLCOWLayers

func MountLCOWLayers(ctx context.Context, containerID string, layers *LCOWLayers, guestRoot string, vm *uvm.UtilityVM) (_, _ string, _ resources.ResourceCloser, err error)

MountLCOWLayers is a helper for clients to hide all the complexity of layer mounting for LCOW Layer folder are in order: base, [rolayer1..rolayern,] scratch Returns the path at which the `rootfs` of the container can be accessed. Also, returns the path inside the UVM at which container scratch directory is located. Usually, this path is the path at which the container scratch VHD is mounted. However, in case of scratch sharing this is a directory under the UVM scratch.

func MountSandboxVolume

func MountSandboxVolume(ctx context.Context, hostPath, volumeName string) (err error)

Mount the sandbox vhd to a user friendly path.

func MountWCOWLayers

func MountWCOWLayers(ctx context.Context, containerID string, layerFolders []string, volumeMountPath string, vm *uvm.UtilityVM) (_ string, _ resources.ResourceCloser, err error)

MountWCOWLayers is a helper for clients to hide all the complexity of layer mounting for WCOW. Layer folder are in order: [rolayerN..rolayer1, base] scratch

v1/v2: Argon WCOW: Returns the mount path on the host as a volume GUID.
v1:    Xenon WCOW: Done internally in HCS, so no point calling doing anything here.
v2:    Xenon WCOW: Returns a CombinedLayersV2 structure where ContainerRootPath is a folder
inside the utility VM which is a GUID mapping of the scratch folder. Each of the layers are
the VSMB locations where the read-only layers are mounted.

Job container: Returns the mount path on the host as a volume guid, with the volume mounted on
the host at `volumeMountPath`.

func ReleaseCimFSHostLayers

func ReleaseCimFSHostLayers(ctx context.Context, scratchLayerFolderPath, containerID string) error

func RemoveSandboxMountPoint

func RemoveSandboxMountPoint(ctx context.Context, hostPath string) error

Remove volume mount point. And remove folder afterwards.

func ToHostHcsSchemaLayers

func ToHostHcsSchemaLayers(ctx context.Context, containerID string, roLayers []string) ([]hcsschema.Layer, error)

ToHostHcsSchemaLayers converts the layer paths for Argon into HCS schema V2 layers

Types

type LCOWLayer

type LCOWLayer struct {
	VHDPath   string
	Partition uint64
}

type LCOWLayers

type LCOWLayers struct {
	// Should be in order from top-most layer to bottom-most layer.
	Layers         []*LCOWLayer
	ScratchVHDPath string
}

LCOWLayers defines a set of LCOW layers. For future extensibility, the LCOWLayer type could be swapped for an interface, and we could either call some method on the interface to "apply" it directly to the UVM, or type cast it to the various types that we support, and use the one it matches. This would allow us to support different "types" of mounts, such as raw VHD, VHD+partition, etc.

Source Files

doc.go layers.go

Version
v0.12.3
Published
Apr 19, 2024
Platform
windows/amd64
Imports
20 packages
Last checked
42 seconds ago

Tools for package owners.