lxc

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2015 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName = "lxc"

DriverName for lxc driver

View Source
const LxcTemplate = `` /* 4320-byte string literal not displayed */

LxcTemplate is the template for lxc driver, it's used to configure LXC.

Variables

View Source
var (
	ErrCannotParse = errors.New("cannot parse raw input")
)

Define error messages

View Source
var ErrExec = errors.New("Unsupported: Exec is not supported by the lxc driver")

ErrExec defines unsupported error message

Functions

This section is empty.

Types

type Driver added in v1.9.0

type Driver struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Driver contains all information for lxc driver, it implements execdriver.Driver

func NewDriver

func NewDriver(root, libPath, initPath string, apparmor bool) (*Driver, error)

NewDriver returns a new lxc driver, called from NewDriver of execdriver

func (*Driver) Clean added in v1.9.0

func (d *Driver) Clean(id string) error

Clean implements the exec driver Driver interface, it's not implemented by lxc.

func (*Driver) Exec added in v1.9.0

func (d *Driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes, hooks execdriver.Hooks) (int, error)

Exec implements the exec driver Driver interface, it is not implemented by lxc.

func (*Driver) GetPidsForContainer added in v1.9.0

func (d *Driver) GetPidsForContainer(id string) ([]int, error)

GetPidsForContainer implements the exec driver Driver interface.

func (*Driver) Info added in v1.9.0

func (d *Driver) Info(id string) execdriver.Info

Info implements the exec driver Driver interface.

func (*Driver) Kill added in v1.9.0

func (d *Driver) Kill(c *execdriver.Command, sig int) error

Kill implements the exec driver Driver interface.

func (*Driver) Name added in v1.9.0

func (d *Driver) Name() string

Name implements the exec driver Driver interface.

func (*Driver) Pause added in v1.9.0

func (d *Driver) Pause(c *execdriver.Command) error

Pause implements the exec driver Driver interface, it executes lxc-freeze to pause a container.

func (*Driver) Run added in v1.9.0

Run implements the exec driver Driver interface, it calls 'exec.Cmd' to launch lxc commands to run a container.

func (*Driver) Stats added in v1.9.0

func (d *Driver) Stats(id string) (*execdriver.ResourceStats, error)

Stats implements the exec driver Driver interface. Lxc doesn't implement it's own Stats, it does some trick by implementing execdriver.Stats to get stats info by libcontainer APIs.

func (*Driver) SupportsHooks added in v1.9.0

func (d *Driver) SupportsHooks() bool

SupportsHooks implements the execdriver Driver interface. The LXC execdriver does not support the hook mechanism, which is currently unique to runC/libcontainer.

func (*Driver) Terminate added in v1.9.0

func (d *Driver) Terminate(c *execdriver.Command) error

Terminate implements the exec driver Driver interface.

func (*Driver) Unpause added in v1.9.0

func (d *Driver) Unpause(c *execdriver.Command) error

Unpause implements the exec driver Driver interface, it executes lxc-unfreeze to unpause a container.

type InitArgs added in v1.2.0

type InitArgs struct {
	User       string
	Gateway    string
	IP         string
	WorkDir    string
	Privileged bool
	Env        []string
	Args       []string
	Mtu        int
	Console    string
	Pipe       int
	Root       string
	CapAdd     string
	CapDrop    string
}

InitArgs contains args provided to the init function for a driver

type TtyConsole added in v1.2.0

type TtyConsole struct {
	MasterPty *os.File
	SlavePty  *os.File
}

TtyConsole implements the exec driver Terminal interface, it stores the master and slave ends of the container's pty.

func NewTtyConsole added in v1.2.0

func NewTtyConsole(processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes) (*TtyConsole, error)

NewTtyConsole returns a new TtyConsole struct. Wired up to the provided process config and stdin/stdout/stderr pipes.

func (*TtyConsole) AttachPipes added in v1.2.0

func (t *TtyConsole) AttachPipes(command *exec.Cmd, pipes *execdriver.Pipes) error

AttachPipes attaches given pipes to exec.Cmd

func (*TtyConsole) Close added in v1.2.0

func (t *TtyConsole) Close() error

Close implements Close method of Terminal interface

func (*TtyConsole) Resize added in v1.2.0

func (t *TtyConsole) Resize(h, w int) error

Resize implements Resize method of Terminal interface

Jump to

Keyboard shortcuts

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