gcs

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const LinuxGcsVsockPort = 0x40000000

LinuxGcsVsockPort is the vsock port number that the Linux GCS will connect to.

Variables

View Source
var WindowsGcsHvHostID = guid.GUID{
	Data1: 0x894cc2d6,
	Data2: 0x9d79,
	Data3: 0x424f,
	Data4: [8]uint8{0x93, 0xfe, 0x42, 0x96, 0x9a, 0xe6, 0xd8, 0xd1},
}

WindowsGcsHvHostID is the hvsock address for the parent of the VM running the GCS

View Source
var WindowsGcsHvsockServiceID = guid.GUID{
	Data1: 0xacef5661,
	Data2: 0x84a1,
	Data3: 0x4e44,
	Data4: [8]uint8{0x85, 0x6b, 0x62, 0x45, 0xe6, 0x9f, 0x46, 0x20},
}

WindowsGcsHvsockServiceID is the hvsock service ID that the Windows GCS will connect to.

Functions

func IsNotExist added in v0.8.15

func IsNotExist(err error) bool

IsNotExist is a helper function to determine if the inner rpc error is Not Exist

Types

type Container

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

Container implements the cow.Container interface for containers created via GuestConnection.

func (*Container) Close

func (c *Container) Close() error

Close releases associated with the container.

func (*Container) CreateProcess

func (c *Container) CreateProcess(ctx context.Context, config interface{}) (_ cow.Process, err error)

CreateProcess creates a process in the container.

func (*Container) ID

func (c *Container) ID() string

ID returns the container's ID.

func (*Container) IsOCI

func (c *Container) IsOCI() bool

IsOCI specifies whether CreateProcess should be called with an OCI specification in its input.

func (*Container) Modify

func (c *Container) Modify(ctx context.Context, config interface{}) (err error)

Modify sends a modify request to the container.

func (*Container) OS

func (c *Container) OS() string

OS returns the operating system of the container, "linux" or "windows".

func (*Container) Properties

func (c *Container) Properties(ctx context.Context, types ...schema1.PropertyType) (_ *schema1.ContainerProperties, err error)

Properties returns the requested container properties targeting a V1 schema container.

func (*Container) PropertiesV2

func (c *Container) PropertiesV2(ctx context.Context, types ...hcsschema.PropertyType) (_ *hcsschema.Properties, err error)

PropertiesV2 returns the requested container properties targeting a V2 schema container.

func (*Container) Shutdown

func (c *Container) Shutdown(ctx context.Context) (err error)

Shutdown sends a graceful shutdown request to the container. The container might not be terminated by the time the request completes (and might never terminate).

func (*Container) Start

func (c *Container) Start(ctx context.Context) (err error)

Start starts the container.

func (*Container) Terminate

func (c *Container) Terminate(ctx context.Context) (err error)

Terminate sends a forceful terminate request to the container. The container might not be terminated by the time the request completes (and might never terminate).

func (*Container) Wait

func (c *Container) Wait() error

Wait waits for the container to terminate (or Close to be called, or the guest connection to terminate).

func (*Container) WaitChannel added in v0.8.25

func (c *Container) WaitChannel() <-chan struct{}

func (*Container) WaitError added in v0.8.25

func (c *Container) WaitError() error

type GuestConnection

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

GuestConnection represents a connection to the GCS.

func (*GuestConnection) Capabilities

func (gc *GuestConnection) Capabilities() *schema1.GuestDefinedCapabilities

Capabilities returns the guest's declared capabilities.

func (*GuestConnection) CloneContainer added in v0.8.15

func (gc *GuestConnection) CloneContainer(ctx context.Context, cid string) (_ *Container, err error)

CloneContainer just creates the wrappers and sets up notification requests for a container that is already running inside the UVM (after cloning).

func (*GuestConnection) Close

func (gc *GuestConnection) Close() error

Close terminates the guest connection. It is undefined to call any other methods on the connection after this is called.

func (*GuestConnection) CreateContainer

func (gc *GuestConnection) CreateContainer(ctx context.Context, cid string, config interface{}) (_ *Container, err error)

CreateContainer creates a container using ID `cid` and `cfg`. The request will likely not be cancellable even if `ctx` becomes done.

func (*GuestConnection) CreateProcess

func (gc *GuestConnection) CreateProcess(ctx context.Context, settings interface{}) (_ cow.Process, err error)

CreateProcess creates a process in the container host.

func (*GuestConnection) DeleteContainerState added in v0.8.8

func (gc *GuestConnection) DeleteContainerState(ctx context.Context, cid string) (err error)

func (*GuestConnection) DumpStacks

func (gc *GuestConnection) DumpStacks(ctx context.Context) (response string, err error)

func (*GuestConnection) IsOCI

func (gc *GuestConnection) IsOCI() bool

IsOCI returns false, indicating that CreateProcess should not be called with an OCI process spec.

func (*GuestConnection) Modify

func (gc *GuestConnection) Modify(ctx context.Context, settings interface{}) (err error)

Modify sends a modify settings request to the null container. This is generally used to prepare virtual hardware that has been added to the guest.

func (*GuestConnection) OS

func (gc *GuestConnection) OS() string

OS returns the operating system of the container's host, "windows" or "linux".

func (*GuestConnection) Protocol

func (gc *GuestConnection) Protocol() uint32

Protocol returns the protocol version that is in use.

type GuestConnectionConfig

type GuestConnectionConfig struct {
	// Conn specifies the connection to use for the bridge. It will be closed
	// when there is an error or Close is called.
	Conn io.ReadWriteCloser
	// Log specifies the logrus entry to use for async log messages.
	Log *logrus.Entry
	// IoListen is the function to use to create listeners for the stdio connections.
	IoListen IoListenFunc
}

GuestConnectionConfig contains options for creating a guest connection.

func (*GuestConnectionConfig) Connect

func (gcc *GuestConnectionConfig) Connect(ctx context.Context, isColdStart bool) (_ *GuestConnection, err error)

Connect establishes a GCS connection. `gcc.Conn` will be closed by this function.

type IoListenFunc

type IoListenFunc func(port uint32) (net.Listener, error)

IoListenFunc is a type for a function that creates a listener for a VM for the vsock port `port`.

func HvsockIoListen

func HvsockIoListen(vmID guid.GUID) IoListenFunc

HvsockIoListen returns an implementation of IoListenFunc that listens on the specified vsock port for the VM specified by `vmID`.

type Process

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

Process represents a process in a container or container host.

func (*Process) Close

func (p *Process) Close() error

Close releases resources associated with the process and closes the associated standard IO streams.

func (*Process) CloseStderr added in v0.8.17

func (p *Process) CloseStderr(ctx context.Context) (err error)

func (*Process) CloseStdin

func (p *Process) CloseStdin(ctx context.Context) (err error)

CloseStdin causes the process to read EOF on its stdin stream.

func (*Process) CloseStdout added in v0.8.17

func (p *Process) CloseStdout(ctx context.Context) (err error)

func (*Process) ExitCode

func (p *Process) ExitCode() (_ int, err error)

ExitCode returns the process's exit code, or an error if the process is still running or the exit code is otherwise unknown.

func (*Process) Kill

func (p *Process) Kill(ctx context.Context) (_ bool, err error)

Kill sends a forceful terminate signal to the process and returns whether the signal was delivered. The process might not be terminated by the time this returns.

func (*Process) Pid

func (p *Process) Pid() int

Pid returns the process ID.

func (*Process) ResizeConsole

func (p *Process) ResizeConsole(ctx context.Context, width, height uint16) (err error)

ResizeConsole requests that the pty associated with the process resize its window.

func (*Process) Signal

func (p *Process) Signal(ctx context.Context, options interface{}) (_ bool, err error)

Signal sends a signal to the process, returning whether it was delivered.

func (*Process) Stdio

func (p *Process) Stdio() (stdin io.Writer, stdout, stderr io.Reader)

Stdio returns the standard IO streams associated with the container. They will be closed when Close is called.

func (*Process) Wait

func (p *Process) Wait() error

Wait waits for the process (or guest connection) to terminate.

Jump to

Keyboard shortcuts

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