lxc

package
v1.4.2-0...-dac92a8 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 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 = `` /* 4248-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

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

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

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

func (*Driver) Exec

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

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

func (*Driver) GetPidsForContainer

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

GetPidsForContainer implements the exec driver Driver interface.

func (*Driver) Info

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

Info implements the exec driver Driver interface.

func (*Driver) Kill

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

Kill implements the exec driver Driver interface.

func (*Driver) Name

func (d *Driver) Name() string

Name implements the exec driver Driver interface.

func (*Driver) Pause

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

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

func (*Driver) Stats

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) Terminate

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

Terminate implements the exec driver Driver interface.

func (*Driver) Unpause

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

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

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

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

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

AttachPipes attaches given pipes to exec.Cmd

func (*TtyConsole) Close

func (t *TtyConsole) Close() error

Close implements Close method of Terminal interface

func (*TtyConsole) Resize

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