package layers

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

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

Index

Constants

const (
	UnmountOperationSCSI  UnmountOperation = 0x01
	UnmountOperationVSMB                   = 0x02
	UnmountOperationVPMEM                  = 0x04
	UnmountOperationAll                    = UnmountOperationSCSI | UnmountOperationVSMB | UnmountOperationVPMEM
)

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, layerFolders []string, guestRoot, volumeMountPath string, vm *uvm.UtilityVM) (_, _ string, 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, guestRoot, volumeMountPath string, vm *uvm.UtilityVM) (_ string, err error)

MountWCOWLayers is a helper for clients to hide all the complexity of layer mounting for WCOW. Layer folder are in order: base, [rolayer1..rolayern,] 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 RemoveSandboxMountPoint

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

Remove volume mount point. And remove folder afterwards.

func UnmountContainerLayers

func UnmountContainerLayers(ctx context.Context, layerFolders []string, containerRootPath, volumeMountPath string, vm *uvm.UtilityVM, op UnmountOperation) error

UnmountContainerLayers is a helper for clients to hide all the complexity of layer unmounting

Types

type ImageLayers

type ImageLayers struct {
	// contains filtered or unexported fields
}

ImageLayers contains all the layers for an image.

func NewImageLayers

func NewImageLayers(vm *uvm.UtilityVM, containerRootInUVM string, layers []string, volumeMountPath string, skipCleanup bool) *ImageLayers

func (*ImageLayers) Release

func (layers *ImageLayers) Release(ctx context.Context, all bool) error

Release unmounts all of the layers located in the layers array.

type UnmountOperation

type UnmountOperation uint

UnmountOperation is used when calling Unmount() to determine what type of unmount is required. In V1 schema, this must be unmountOperationAll. In V2, client can be more optimal and only unmount what they need which can be a minor performance improvement (eg if you know only one container is running in a utility VM, and the UVM is about to be torn down, there's no need to unmount the VSMB shares, just SCSI to have a consistent file system).

Source Files

doc.go layers.go

Version
v0.10.0-rc.1
Published
Aug 12, 2022
Platform
windows/amd64
Imports
15 packages
Last checked
4 minutes ago

Tools for package owners.