package hcsoci

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

Index

Constants

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

Functions

func MountContainerLayers

func MountContainerLayers(layerFolders []string, guestRoot string, uvm *uvm.UtilityVM) (interface{}, error)

mountContainerLayers is a helper for clients to hide all the complexity of layer mounting 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.

func ReleaseResources

func ReleaseResources(r *Resources, vm *uvm.UtilityVM, all bool) error

TODO: Method on the resources?

func UnmountContainerLayers

func UnmountContainerLayers(layerFolders []string, guestRoot string, uvm *uvm.UtilityVM, op UnmountOperation) error

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

Types

type CreateOptions

type CreateOptions struct {

	// Common parameters
	ID               string             // Identifier for the container
	Owner            string             // Specifies the owner. Defaults to executable name.
	Spec             *specs.Spec        // Definition of the container or utility VM being created
	SchemaVersion    *hcsschema.Version // Requested Schema Version. Defaults to v2 for RS5, v1 for RS1..RS4
	HostingSystem    *uvm.UtilityVM     // Utility or service VM in which the container is to be created.
	NetworkNamespace string             // Host network namespace to use (overrides anything in the spec)

	// This is an advanced debugging parameter. It allows for diagnosibility by leaving a containers
	// resources allocated in case of a failure. Thus you would be able to use tools such as hcsdiag
	// to look at the state of a utility VM to see what resources were allocated. Obviously the caller
	// must a) not tear down the utility VM on failure (or pause in some way) and b) is responsible for
	// performing the ReleaseResources() call themselves.
	DoNotReleaseResourcesOnFailure bool
}

CreateOptions are the set of fields used to call CreateContainer(). Note: In the spec, the LayerFolders must be arranged in the same way in which moby configures them: layern, layern-1,...,layer2,layer1,scratch where layer1 is the base read-only layer, layern is the top-most read-only layer, and scratch is the RW layer. This is for historical reasons only.

type Resources

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

Resources is the structure returned as part of creating a container. It holds nothing useful to clients, hence everything is lowercased. A client would use it in a call to ReleaseResource to ensure everything is cleaned up when a container exits.

func CreateContainer

func CreateContainer(createOptions *CreateOptions) (_ *hcs.System, _ *Resources, err error)

CreateContainer creates a container. It can cope with a wide variety of scenarios, including v1 HCS schema calls, as well as more complex v2 HCS schema calls. Note we always return the resources that have been allocated, even in the case of an error. This provides support for the debugging option not to release the resources on failure, so that the client can make the necessary call to release resources that have been allocated as part of calling this function.

func (*Resources) NetNS

func (r *Resources) NetNS() string

NetNS returns the network namespace for the container

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

create.go hcsdoc_lcow.go hcsdoc_wcow.go layers.go network.go resources.go resources_lcow.go resources_wcow.go

Version
v0.7.8
Published
Oct 9, 2018
Platform
windows/amd64
Imports
26 packages
Last checked
51 minutes ago

Tools for package owners.