types

package
v0.0.0-...-5cef3e7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HybridVSockScheme = "hvsock"
	VSockScheme       = "vsock"
)
View Source
const CCWBridgeMaxCapacity = 0xffff
View Source
const PCIBridgeMaxCapacity = 30

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

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

Asset represents a virtcontainers asset.

func NewAsset

func NewAsset(anno map[string]string, t AssetType) (*Asset, error)

NewAsset returns a new asset from a slice of annotations.

func (*Asset) Hash

func (a *Asset) Hash(hashType string) (string, error)

Hash returns the hex encoded string for the asset hash

func (Asset) Path

func (a Asset) Path() string

Path returns an asset path.

func (Asset) Type

func (a Asset) Type() AssetType

Type returns an asset type.

func (*Asset) Valid

func (a *Asset) Valid() bool

Valid checks if an asset is valid or not.

type AssetType

type AssetType string

AssetType describe a type of assets.

const (
	// KernelAsset is a kernel asset.
	KernelAsset AssetType = "kernel"

	// ImageAsset is an image asset.
	ImageAsset AssetType = "image"

	// InitrdAsset is an intird asset.
	InitrdAsset AssetType = "initrd"

	// HypervisorAsset is an hypervisor asset.
	HypervisorAsset AssetType = "hypervisor"

	// HypervisorCtlAsset is an hypervisor control asset.
	HypervisorCtlAsset AssetType = "hypervisorctl"
	// JailerAsset is an jailer asset.
	JailerAsset AssetType = "jailer"

	// FirmwareAsset is a firmware asset.
	FirmwareAsset AssetType = "firmware"
)

func (AssetType) Annotations

func (t AssetType) Annotations() (string, string, error)

Annotations returns the path and hash annotations for a given Asset type.

type Bridge

type Bridge struct {
	// Devices contains information about devices plugged and its address in the bridge
	Devices map[uint32]string

	// ID is used to identify the bridge in the hypervisor
	ID string

	// Addr is the slot of the bridge
	Addr int

	// Type is the type of the bridge (pci, pcie, etc)
	Type Type

	// MaxCapacity is the max capacity of the bridge
	MaxCapacity uint32
}

func NewBridge

func NewBridge(bt Type, id string, devices map[uint32]string, addr int) Bridge

func (*Bridge) AddDevice

func (b *Bridge) AddDevice(ID string) (uint32, error)

func (*Bridge) AddressFormatCCW

func (b *Bridge) AddressFormatCCW(addr string) (string, error)

AddressFormatCCW returns the address format for the device number. The channel subsystem-ID 0xfe is reserved to the virtual channel and the address format is in the form fe.n.dddd, where n is subchannel set ID and ddd the device number. More details at https://www.ibm.com/support/knowledgecenter/en/linuxonibm/com.ibm.linux.z.ldva/ldva_t_configuringSCSIdevices.html

func (*Bridge) AddressFormatCCWForVirtServer

func (b *Bridge) AddressFormatCCWForVirtServer(addr string) (string, error)

AddressFormatCCWForVirtServer returns the address format for the virtual server. The address format is in the form of 0.n.dddd

func (*Bridge) RemoveDevice

func (b *Bridge) RemoveDevice(ID string) error

type Capabilities

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

Capabilities describe a virtcontainers hypervisor capabilities through a bit mask.

func (*Capabilities) IsBlockDeviceHotplugSupported

func (caps *Capabilities) IsBlockDeviceHotplugSupported() bool

IsBlockDeviceHotplugSupported tells if an hypervisor supports hotplugging block devices.

func (*Capabilities) IsBlockDeviceSupported

func (caps *Capabilities) IsBlockDeviceSupported() bool

IsBlockDeviceSupported tells if an hypervisor supports block devices.

func (*Capabilities) IsFsSharingSupported

func (caps *Capabilities) IsFsSharingSupported() bool

IsFsSharingSupported tells if an hypervisor supports host filesystem sharing.

func (*Capabilities) IsMultiQueueSupported

func (caps *Capabilities) IsMultiQueueSupported() bool

IsMultiQueueSupported tells if an hypervisor supports device multi queue support.

func (*Capabilities) SetBlockDeviceHotplugSupport

func (caps *Capabilities) SetBlockDeviceHotplugSupport()

SetBlockDeviceHotplugSupport sets the block device hotplugging capability to true.

func (*Capabilities) SetBlockDeviceSupport

func (caps *Capabilities) SetBlockDeviceSupport()

SetBlockDeviceSupport sets the block device support capability to true.

func (*Capabilities) SetFsSharingSupport

func (caps *Capabilities) SetFsSharingSupport()

SetFsSharingUnsupported sets the host filesystem sharing capability to true.

func (*Capabilities) SetMultiQueueSupport

func (caps *Capabilities) SetMultiQueueSupport()

SetMultiQueueSupport sets the device multi queue capability to true.

type Cmd

type Cmd struct {
	Args                []string
	Envs                []EnvVar
	SupplementaryGroups []string

	// Note that these fields *MUST* remain as strings.
	//
	// The reason being that we want runtimes to be able to support CLI
	// operations like "exec --user=". That option allows the
	// specification of a user (either as a string username or a numeric
	// UID), and may optionally also include a group (groupame or GID).
	//
	// Since this type is the interface to allow the runtime to specify
	// the user and group the workload can run as, these user and group
	// fields cannot be encoded as integer values since that would imply
	// the runtime itself would need to perform a UID/GID lookup on the
	// user-specified username/groupname. But that isn't practically
	// possible given that to do so would require the runtime to access
	// the image to allow it to interrogate the appropriate databases to
	// convert the username/groupnames to UID/GID values.
	//
	// Note that this argument applies solely to the _runtime_ supporting
	// a "--user=" option when running in a "standalone mode" - there is
	// no issue when the runtime is called by a container manager since
	// all the user and group mapping is handled by the container manager
	// and specified to the runtime in terms of UID/GID's in the
	// configuration file generated by the container manager.
	User         string
	PrimaryGroup string
	WorkDir      string
	Console      string
	Capabilities *specs.LinuxCapabilities

	Interactive     bool
	Detach          bool
	NoNewPrivileges bool
}

Cmd represents a command to execute in a running container.

type ContainerState

type ContainerState struct {
	State StateString `json:"state"`

	BlockDeviceID string

	// File system of the rootfs incase it is block device
	Fstype string `json:"fstype"`

	// CgroupPath is the cgroup hierarchy where sandbox's processes
	// including the hypervisor are placed.
	CgroupPath string `json:"cgroupPath,omitempty"`
}

ContainerState is a sandbox state structure.

func (*ContainerState) Valid

func (state *ContainerState) Valid() bool

Valid checks that the container state is valid.

func (*ContainerState) ValidTransition

func (state *ContainerState) ValidTransition(oldState StateString, newState StateString) error

ValidTransition returns an error if we want to move to an unreachable state.

type EnvVar

type EnvVar struct {
	Var   string
	Value string
}

EnvVar is a key/value structure representing a command environment variable.

type FcConfig

type FcConfig struct {
	BootSource *models.BootSource `json:"boot-source"`

	MachineConfig *models.MachineConfiguration `json:"machine-config"`

	Drives []*models.Drive `json:"drives,omitempty"`

	Vsock *models.Vsock `json:"vsock,omitempty"`

	NetworkInterfaces []*models.NetworkInterface `json:"network-interfaces,omitempty"`

	Logger *models.Logger `json:"logger,omitempty"`
}

type HybridVSock

type HybridVSock struct {
	UdsPath   string
	ContextID uint64
	Port      uint32
}

HybridVSock defines a hybrid vsocket to communicate between the host and any process inside the VM. This is a virtio-vsock implementation based on AF_VSOCK on the guest side and multiple AF_UNIX sockets on the host side. This kind of socket is not supported in all hypervisors. Firecracker supports it.

func (*HybridVSock) String

func (s *HybridVSock) String() string

type Resources

type Resources struct {
	// Memory is the amount of available memory in MiB.
	Memory      uint
	MemorySlots uint8
}

Resources describes VM resources configuration.

type SandboxState

type SandboxState struct {
	State StateString `json:"state"`

	// Index map of the block device passed to hypervisor.
	BlockIndexMap map[int]struct{} `json:"blockIndexMap"`

	// GuestMemoryBlockSizeMB is the size of memory block of guestos
	GuestMemoryBlockSizeMB uint32 `json:"guestMemoryBlockSize"`

	// GuestMemoryHotplugProbe determines whether guest kernel supports memory hotplug probe interface
	GuestMemoryHotplugProbe bool `json:"guestMemoryHotplugProbe"`

	// CgroupPath is the cgroup hierarchy where sandbox's processes
	// including the hypervisor are placed.
	CgroupPath string `json:"cgroupPath,omitempty"`

	// Path to all the cgroups setup for a container. Key is cgroup subsystem name
	// with the value as the path.
	CgroupPaths map[string]string `json:"cgroupPaths"`

	// PersistVersion indicates current storage api version.
	// It's also known as ABI version of kata-runtime.
	// Note: it won't be written to disk
	PersistVersion uint `json:"-"`
}

SandboxState is a sandbox state structure

func (*SandboxState) Valid

func (state *SandboxState) Valid() bool

Valid checks that the sandbox state is valid.

func (*SandboxState) ValidTransition

func (state *SandboxState) ValidTransition(oldState StateString, newState StateString) error

ValidTransition returns an error if we want to move to an unreachable state.

type Socket

type Socket struct {
	DeviceID string
	ID       string
	HostPath string
	Name     string
}

Socket defines a socket to communicate between the host and any process inside the VM.

type Sockets

type Sockets []Socket

Sockets is a Socket list.

func (*Sockets) Set

func (s *Sockets) Set(sockStr string) error

Set assigns socket values from string to a Socket.

func (*Sockets) String

func (s *Sockets) String() string

String converts a Socket to a string.

type StateString

type StateString string

StateString is a string representing a sandbox state.

const (
	// StateReady represents a sandbox/container that's ready to be run
	StateReady StateString = "ready"

	// StateRunning represents a sandbox/container that's currently running.
	StateRunning StateString = "running"

	// StatePaused represents a sandbox/container that has been paused.
	StatePaused StateString = "paused"

	// StateStopped represents a sandbox/container that has been stopped.
	StateStopped StateString = "stopped"
)

type Type

type Type string

Type represents a type of bus and bridge.

const (
	// PCI represents a PCI bus and bridge
	PCI Type = "pci"

	// PCIE represents a PCIe bus and bridge
	PCIE Type = "pcie"
)
const (
	CCW Type = "ccw"
)

type VSock

type VSock struct {
	ContextID uint64
	Port      uint32
	VhostFd   *os.File
}

VSock defines a virtio-socket to communicate between the host and any process inside the VM. This kind of socket is not supported in all hypervisors.

func (*VSock) String

func (s *VSock) String() string

type Volume

type Volume struct {
	// MountTag is a label used as a hint to the guest.
	MountTag string

	// HostPath is the host filesystem path for this volume.
	HostPath string
}

Volume is a shared volume between the host and the VM, defined by its mount tag and its host path.

type Volumes

type Volumes []Volume

Volumes is a Volume list.

func (*Volumes) Set

func (v *Volumes) Set(volStr string) error

Set assigns volume values from string to a Volume.

func (*Volumes) String

func (v *Volumes) String() string

String converts a Volume to a string.

Jump to

Keyboard shortcuts

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