hcsoci

package
v0.8.16 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MappedDirectoryResourcePath = "Container/MappedDirectories"
	MappedPipeResourcePath      = "Container/MappedPipes"
)

Variables

This section is empty.

Functions

func CloneContainer added in v0.8.15

func CloneContainer(ctx context.Context, createOptions *CreateOptions) (_ cow.Container, _ *resources.Resources, err error)

CloneContainer is similar to CreateContainer but it does not add layers or namespace like CreateContainer does. Also, instead of sending create container request it sends a modify request to an existing container. CloneContainer only works for WCOW.

func ConvertCPULimits added in v0.8.16

func ConvertCPULimits(ctx context.Context, cid string, spec *specs.Spec, maxCPUCount int32) (int32, int32, int32, error)

ConvertCPULimits handles the logic of converting and validating the containers CPU limits specified in the OCI spec to what HCS expects.

`cid` is the container's ID.

`vmid` is the Utility VM's ID if the container we're constructing is going to belong to one.

`spec` is the OCI spec for the container.

`maxCPUCount` is the maximum cpu count allowed for the container. This value should be the number of processors on the host, or in the case of a hypervisor isolated container the number of processors assigned to the guest/Utility VM.

Returns the cpu count, cpu limit, and cpu weight in this order. Returns an error if more than one of cpu count, cpu limit, or cpu weight was specified in the OCI spec as they are mutually exclusive.

func CreateContainer

func CreateContainer(ctx context.Context, createOptions *CreateOptions) (_ cow.Container, _ *resources.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.

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

	// ScaleCPULimitsToSandbox indicates that the container CPU limits should be adjusted to account
	// for the difference in CPU count between the host and the UVM.
	ScaleCPULimitsToSandbox 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.

Jump to

Keyboard shortcuts

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