hypervisor

package
v0.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BaseDir         = "/var/run/hyper"
	HyperSockName   = "hyper.sock"
	TtySockName     = "tty.sock"
	ConsoleSockName = "console.sock"
	ShareDirTag     = "share_dir"
	DefaultKernel   = "/var/lib/hyper/kernel"
	DefaultInitrd   = "/var/lib/hyper/hyper-initrd.img"
	DetachKeys      = "ctrl-p,ctrl-q"

	// cpu/mem hotplug constants
	DefaultMaxCpus = 8     // CONFIG_NR_CPUS hyperstart.git/build/kernel_config
	DefaultMaxMem  = 32768 // size in MiB
)
View Source
const (
	ST_CREATING = iota
	ST_CREATED
	ST_STARTING
	ST_RUNNING
	ST_STOPPING
)
View Source
const (
	EVENT_VM_EXIT = iota
	EVENT_VM_KILL
	EVENT_VM_TIMEOUT
	EVENT_INIT_CONNECTED
	// TODO EVENT_BLOCK_EJECTED EVENT_BLOCK_INSERTED EVENT_INTERFACE_ADD EVENT_INTERFACE_INSERTED EVENT_INTERFACE_EJECTED are not referenced expect in events.go
	EVENT_BLOCK_INSERTED
	EVENT_BLOCK_EJECTED
	EVENT_INTERFACE_ADD
	EVENT_INTERFACE_INSERTED
	EVENT_INTERFACE_EJECTED
	COMMAND_SHUTDOWN
	COMMAND_RELEASE
	COMMAND_ATTACH
	COMMAND_PAUSEVM
	ERROR_VM_START_FAILED
	ERROR_INIT_FAIL
	ERROR_QMP_FAIL
	ERROR_INTERRUPTED
)
View Source
const (
	PauseStateUnpaused = iota
	PauseStatePaused
)
View Source
const (
	ET_SPEC      string = "SPEC_ERROR"
	ET_BUSY      string = "RESOURSE_UNAVAILABLE"
	ET_DEVICE    string = "DEVICE_OPERATION_FAIL"
	ET_NOT_READY string = "VM_NOT_READY"
)
View Source
const (
	ERROR   = hlog.ERROR
	WARNING = hlog.WARNING
	INFO    = hlog.INFO
	DEBUG   = hlog.DEBUG
	TRACE   = hlog.TRACE
	EXTRA   = hlog.EXTRA
)
View Source
const (
	MAX_NIC = int(^uint(0) >> 1) // Eth is network card, while lo is alias, what's the maximum for each? same?
	// let upper level logic care about the restriction. here is just an upbond.
	DEFAULT_LO_DEVICE_NAME = "lo"
)
View Source
const (
	StateRunning     = "RUNNING"
	StateTerminating = "TERMINATING"
	StateNone        = "NONE"
)

states

View Source
const CURRENT_PERSIST_VERSION = 20170224
View Source
const (
	VmLogdSock = "/var/run/vmlogd.sock"
)

Variables

View Source
var InterfaceCount int = 1
View Source
var PciAddrFrom int = 0x05
View Source
var VsockCidManager vsock.VsockCidAllocator

Functions

func EventString

func EventString(ev int) string

func InitNetwork

func InitNetwork(bIface, bIP string, disableIptables bool) error

func NewVmSpec added in v0.8.0

func NewVmSpec() *hyperstartapi.Pod

func SupportLazyMode

func SupportLazyMode() bool

func TtyLiner

func TtyLiner(conn io.Reader, output chan string)

func UnblockSend

func UnblockSend(ch chan *types.VmResponse, u *types.VmResponse)

Types

type AttachCommand

type AttachCommand struct {
	Streams   *TtyIO
	Container string
}

func (*AttachCommand) Event

func (qe *AttachCommand) Event() int

type BlockdevInsertedEvent

type BlockdevInsertedEvent struct {
	Name       string
	SourceType string //image or volume
	DeviceName string
	ScsiId     int
	ScsiAddr   string // pass scsi addr to hyperstart
}

func (*BlockdevInsertedEvent) Event

func (qe *BlockdevInsertedEvent) Event() int

type BootConfig

type BootConfig struct {
	CPU              int
	Memory           int
	HotAddCpuMem     bool
	BootToBeTemplate bool
	BootFromTemplate bool
	EnableVsock      bool
	MemoryPath       string
	DevicesStatePath string
	Kernel           string
	Initrd           string
	Bios             string
	Cbfs             string
	Vbox             string

	// For network QoS (kilobytes/s)
	InboundAverage  string
	InboundPeak     string
	OutboundAverage string
	OutboundPeak    string
}

type CommonError added in v0.8.0

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

implement error, hypervisor.Error, and api.Result

func NewBusyError added in v0.8.0

func NewBusyError(id, cause string) *CommonError

func NewDeviceError added in v0.8.0

func NewDeviceError(id, cause string) *CommonError

func NewNotReadyError added in v0.8.0

func NewNotReadyError(id string) *CommonError

func NewSpecError added in v0.8.0

func NewSpecError(id, cause string) *CommonError

Error in spec, which is either mistake format or content inconsistency, and is checked when elements are being added to Sandbox.

func (*CommonError) Error added in v0.8.0

func (err *CommonError) Error() string

func (*CommonError) IsSuccess added in v0.8.0

func (err *CommonError) IsSuccess() bool

func (*CommonError) Message added in v0.8.0

func (err *CommonError) Message() string

func (*CommonError) ResultId added in v0.8.0

func (err *CommonError) ResultId() string

func (*CommonError) Type added in v0.8.0

func (err *CommonError) Type() string

type ContainerContext added in v0.8.0

type ContainerContext struct {
	*api.ContainerDescription
	// contains filtered or unexported fields
}

func (*ContainerContext) Log added in v0.8.0

func (cc *ContainerContext) Log(level hlog.LogLevel, args ...interface{})

func (*ContainerContext) LogPrefix added in v0.8.0

func (cc *ContainerContext) LogPrefix() string

func (*ContainerContext) VmSpec added in v0.8.0

type DeviceFailed

type DeviceFailed struct {
	Session VmEvent
}

func (*DeviceFailed) Event

func (qe *DeviceFailed) Event() int

func (*DeviceFailed) IsSuccess added in v0.8.0

func (df *DeviceFailed) IsSuccess() bool

func (*DeviceFailed) Message added in v0.8.0

func (df *DeviceFailed) Message() string

func (*DeviceFailed) ResultId added in v0.8.0

func (df *DeviceFailed) ResultId() string

Device Failed as api.Result

type DiskContext added in v0.8.0

type DiskContext struct {
	*DiskDescriptor
	// contains filtered or unexported fields
}

func NewDiskContext added in v0.8.0

func NewDiskContext(ctx *VmContext, vol *api.VolumeDescription) *DiskContext

type DiskDescriptor added in v0.8.0

type DiskDescriptor struct {
	Name         string
	Filename     string
	Format       string
	Fstype       string
	DeviceName   string
	ScsiId       int
	ScsiAddr     string
	DockerVolume bool
	Options      map[string]string
}

func (*DiskDescriptor) IsDir added in v0.8.0

func (d *DiskDescriptor) IsDir() bool

func (*DiskDescriptor) IsNas added in v0.8.0

func (d *DiskDescriptor) IsNas() bool

type DriverContext

type DriverContext interface {
	Launch(ctx *VmContext)
	Associate(ctx *VmContext)
	Dump() (map[string]interface{}, error)

	AddDisk(ctx *VmContext, sourceType string, blockInfo *DiskDescriptor, result chan<- VmEvent)
	RemoveDisk(ctx *VmContext, blockInfo *DiskDescriptor, callback VmEvent, result chan<- VmEvent)

	AddNic(ctx *VmContext, host *HostNicInfo, guest *GuestNicInfo, result chan<- VmEvent)
	RemoveNic(ctx *VmContext, n *InterfaceCreated, callback VmEvent, result chan<- VmEvent)

	SetCpus(ctx *VmContext, cpus int) error
	AddMem(ctx *VmContext, slot, size int) error

	Save(ctx *VmContext, path string) error

	Shutdown(ctx *VmContext)
	Kill(ctx *VmContext)

	Pause(ctx *VmContext, pause bool) error

	ConfigureNetwork(vmId, requestedIP string, config *api.InterfaceDescription) (*network.Settings, error)
	AllocateNetwork(vmId, requestedIP string) (*network.Settings, error)
	ReleaseNetwork(vmId, releasedIP string, file *os.File) error

	Stats(ctx *VmContext) (*types.PodStats, error)

	Close()
}

type EmptyContext

type EmptyContext struct{}

func (*EmptyContext) AddDisk

func (ec *EmptyContext) AddDisk(ctx *VmContext, sourceType string, blockInfo *DiskDescriptor, result chan<- VmEvent)

func (*EmptyContext) AddMem

func (ec *EmptyContext) AddMem(ctx *VmContext, slot, size int) error

func (*EmptyContext) AddNic

func (ec *EmptyContext) AddNic(ctx *VmContext, host *HostNicInfo, guest *GuestNicInfo, result chan<- VmEvent)

func (*EmptyContext) AllocateNetwork

func (ec *EmptyContext) AllocateNetwork(vmId, requestedIP string) (*network.Settings, error)

func (*EmptyContext) Associate

func (ec *EmptyContext) Associate(ctx *VmContext)

func (*EmptyContext) BuildinNetwork

func (ec *EmptyContext) BuildinNetwork() bool

func (*EmptyContext) Close

func (ec *EmptyContext) Close()

func (*EmptyContext) ConfigureNetwork

func (ec *EmptyContext) ConfigureNetwork(vmId, requestedIP string, config *api.InterfaceDescription) (*network.Settings, error)

func (*EmptyContext) Dump

func (ec *EmptyContext) Dump() (map[string]interface{}, error)

func (*EmptyContext) Kill

func (ec *EmptyContext) Kill(ctx *VmContext)

func (*EmptyContext) Launch

func (ec *EmptyContext) Launch(ctx *VmContext)

func (*EmptyContext) Pause

func (ec *EmptyContext) Pause(ctx *VmContext, pause bool) error

func (*EmptyContext) ReleaseNetwork

func (ec *EmptyContext) ReleaseNetwork(vmId, releasedIP string, file *os.File) error

func (*EmptyContext) RemoveDisk

func (ec *EmptyContext) RemoveDisk(ctx *VmContext, blockInfo *DiskDescriptor, callback VmEvent, result chan<- VmEvent)

func (*EmptyContext) RemoveNic

func (ec *EmptyContext) RemoveNic(ctx *VmContext, n *InterfaceCreated, callback VmEvent, result chan<- VmEvent)

func (*EmptyContext) Save

func (ec *EmptyContext) Save(ctx *VmContext, path string) error

func (*EmptyContext) SetCpus

func (ec *EmptyContext) SetCpus(ctx *VmContext, cpus int) error

func (*EmptyContext) Shutdown

func (ec *EmptyContext) Shutdown(ctx *VmContext)

func (*EmptyContext) Stats

func (ec *EmptyContext) Stats(ctx *VmContext) (*types.PodStats, error)

type EmptyDriver

type EmptyDriver struct{}

func (*EmptyDriver) InitContext

func (ed *EmptyDriver) InitContext(homeDir string) DriverContext

func (*EmptyDriver) Initialize

func (ed *EmptyDriver) Initialize() error

func (*EmptyDriver) LoadContext

func (ed *EmptyDriver) LoadContext(persisted map[string]interface{}) (DriverContext, error)

func (*EmptyDriver) Name added in v0.6.2

func (ed *EmptyDriver) Name() string

func (*EmptyDriver) SupportLazyMode

func (ed *EmptyDriver) SupportLazyMode() bool

func (*EmptyDriver) SupportVmSocket added in v0.8.0

func (ed *EmptyDriver) SupportVmSocket() bool

type Errors added in v0.8.0

type Errors interface {
	Type() string
}

type Fanout

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

func CreateFanout

func CreateFanout(upstream chan *types.VmResponse, size int, block bool) *Fanout

CreateFanout create a new fanout, and if it is non-blocked, it will start the fanout goroutine at once, otherwise it will start the goroutine when it get the first client

func (*Fanout) Acquire

func (fo *Fanout) Acquire() (chan *types.VmResponse, error)

func (*Fanout) Close

func (fo *Fanout) Close()

func (*Fanout) Release

func (fo *Fanout) Release(client chan *types.VmResponse) error

type GuestNicInfo

type GuestNicInfo struct {
	Device  string
	Ipaddr  string
	Index   int
	Busaddr int
}

type HostNicInfo

type HostNicInfo struct {
	Id      string
	Fd      uint64
	Device  string
	Mac     string
	Bridge  string
	Gateway string
}

type HypervisorDriver

type HypervisorDriver interface {
	Name() string
	InitContext(homeDir string) DriverContext

	LoadContext(persisted map[string]interface{}) (DriverContext, error)

	BuildinNetwork() bool

	InitNetwork(bIface, bIP string, disableIptables bool) error

	SupportLazyMode() bool
	SupportVmSocket() bool
}
var HDriver HypervisorDriver

type InitConnectedEvent

type InitConnectedEvent struct{}

func (*InitConnectedEvent) Event

func (qe *InitConnectedEvent) Event() int

type InitFailedEvent

type InitFailedEvent struct {
	Reason string
}

func (*InitFailedEvent) Event

func (qe *InitFailedEvent) Event() int

type InterfaceCreated

type InterfaceCreated struct {
	Id         string //user specified in (ref api.InterfaceDescription: a user identifier of interface, user may use this to specify a nic, normally you can use IPAddr as an Id, however, in some driver (probably vbox?), user may not specify the IPAddr.)
	Index      int
	PCIAddr    int
	Fd         *os.File
	Bridge     string
	HostDevice string
	DeviceName string
	MacAddr    string
	IpAddr     string
	NetMask    string
	RouteTable []*RouteRule
}

func (*InterfaceCreated) Event

func (qe *InterfaceCreated) Event() int

type Interrupted

type Interrupted struct {
	Reason string
}

func (*Interrupted) Event

func (qe *Interrupted) Event() int

type LazyDriverContext

type LazyDriverContext interface {
	DriverContext

	LazyLaunch(ctx *VmContext)
	InitVM(ctx *VmContext) error
	LazyAddDisk(ctx *VmContext, name, sourceType, filename, format string, id int)
	LazyAddNic(ctx *VmContext, host *HostNicInfo, guest *GuestNicInfo)
}

type LogMessage added in v0.8.1

type LogMessage struct {
	Message string
	Id      string
	Path    string
}

type NetDevInsertedEvent

type NetDevInsertedEvent struct {
	Id         string
	Index      int
	DeviceName string
	Address    int
}

func (*NetDevInsertedEvent) Event

func (qe *NetDevInsertedEvent) Event() int

func (*NetDevInsertedEvent) IsSuccess added in v0.8.0

func (ne *NetDevInsertedEvent) IsSuccess() bool

func (*NetDevInsertedEvent) Message added in v0.8.0

func (ne *NetDevInsertedEvent) Message() string

func (*NetDevInsertedEvent) ResultId added in v0.8.0

func (ne *NetDevInsertedEvent) ResultId() string

type NetDevRemovedEvent

type NetDevRemovedEvent struct {
	Index int
}

func (*NetDevRemovedEvent) Event

func (qe *NetDevRemovedEvent) Event() int

type NetworkContext added in v0.8.0

type NetworkContext struct {
	*api.SandboxConfig
	// contains filtered or unexported fields
}

func NewNetworkContext added in v0.8.0

func NewNetworkContext() *NetworkContext

type PersistInfo

type PersistInfo struct {
	PersistVersion int
	Id             string
	DriverInfo     map[string]interface{}
	VmSpec         *hyperstartapi.Pod
	HwStat         *VmHwStatus
	VolumeList     []*PersistVolumeInfo
	NetworkList    []*PersistNetworkInfo
	PortList       []*api.PortDescription
}

func (*PersistInfo) Log added in v0.8.1

func (p *PersistInfo) Log(level hlog.LogLevel, args ...interface{})

func (*PersistInfo) LogLevel added in v0.8.1

func (p *PersistInfo) LogLevel(level hlog.LogLevel) bool

func (*PersistInfo) LogPrefix added in v0.8.1

func (p *PersistInfo) LogPrefix() string

type PersistNetworkInfo

type PersistNetworkInfo struct {
	Id         string
	Index      int
	PciAddr    int
	DeviceName string
	IpAddr     string
}

type PersistVolumeInfo

type PersistVolumeInfo struct {
	Name         string
	Filename     string
	Format       string
	Fstype       string
	DeviceName   string
	ScsiId       int
	ContainerIds []string
	IsRootVol    bool
	Containers   []int // deprecated
	MontPoints   []string
}

type ReleaseVMCommand

type ReleaseVMCommand struct{}

func (*ReleaseVMCommand) Event

func (qe *ReleaseVMCommand) Event() int

type RouteRule

type RouteRule struct {
	Destination string
	Gateway     string
	ViaThis     bool
}

type ShutdownCommand

type ShutdownCommand struct {
	Wait bool
}

func (*ShutdownCommand) Event

func (qe *ShutdownCommand) Event() int

type TtyIO

type TtyIO struct {
	Stdin  io.ReadCloser
	Stdout io.Writer
	Stderr io.Writer
}

TODO move this logic to hyperd

func (*TtyIO) Close

func (tty *TtyIO) Close()

type Vm

type Vm struct {
	Id string

	Cpu  int
	Mem  int
	Lazy bool
	// contains filtered or unexported fields
}

func AssociateVm added in v0.8.0

func AssociateVm(vmId string, data []byte) (*Vm, error)

This function will only be invoked during daemon start

func GetVm

func GetVm(vmId string, b *BootConfig, waitStarted bool) (*Vm, error)

func (*Vm) AddContainer added in v0.8.0

func (vm *Vm) AddContainer(c *api.ContainerDescription) api.Result

func (*Vm) AddCpu

func (vm *Vm) AddCpu(totalCpu int) error

TODO: deprecated api, it will be removed after the hyper.git updated

func (*Vm) AddMem

func (vm *Vm) AddMem(totalMem int) error

func (*Vm) AddNic

func (vm *Vm) AddNic(info *api.InterfaceDescription) error

func (*Vm) AddProcess

func (vm *Vm) AddProcess(process *api.Process, tty *TtyIO) error

func (*Vm) AddRoute added in v0.6.2

func (vm *Vm) AddRoute() error

func (*Vm) AddVolume added in v0.8.0

func (vm *Vm) AddVolume(vol *api.VolumeDescription) api.Result

func (*Vm) AssociateContainer added in v0.8.0

func (vm *Vm) AssociateContainer(container string) (alive bool, err error)

Should only be called near after AssociateVm

func (*Vm) Attach

func (vm *Vm) Attach(tty *TtyIO, container string) error

func (*Vm) DeleteNic added in v0.6.2

func (vm *Vm) DeleteNic(id string) error

func (*Vm) Dump added in v0.8.0

func (vm *Vm) Dump() ([]byte, error)

func (*Vm) Exec

func (vm *Vm) Exec(container, execId, cmd string, terminal bool, tty *TtyIO) error

func (*Vm) GetIPAddrs added in v0.8.0

func (vm *Vm) GetIPAddrs() []string

func (*Vm) GetResponseChan

func (vm *Vm) GetResponseChan() (chan *types.VmResponse, error)

func (*Vm) HyperstartExec added in v0.8.0

func (vm *Vm) HyperstartExec(cmd string, tty *TtyIO) (int, error)

func (*Vm) HyperstartExecSync added in v0.8.0

func (vm *Vm) HyperstartExecSync(cmd []string, stdin []byte) (stdout, stderr []byte, err error)

func (*Vm) InitSandbox added in v0.8.0

func (vm *Vm) InitSandbox(config *api.SandboxConfig) error

func (*Vm) Kill

func (vm *Vm) Kill()

TODO: should we provide a method to force kill vm

func (*Vm) KillContainer

func (vm *Vm) KillContainer(container string, signal syscall.Signal) error

func (*Vm) Launch

func (vm *Vm) Launch(b *BootConfig) (err error)

func (*Vm) Log added in v0.8.1

func (v *Vm) Log(level hlog.LogLevel, args ...interface{})

func (*Vm) LogLevel added in v0.8.1

func (v *Vm) LogLevel(level hlog.LogLevel) bool

func (*Vm) LogPrefix added in v0.8.1

func (v *Vm) LogPrefix() string

func (*Vm) OnlineCpuMem

func (vm *Vm) OnlineCpuMem() error

func (*Vm) Pause

func (vm *Vm) Pause(pause bool) error

func (*Vm) ReadFile

func (vm *Vm) ReadFile(container, target string) ([]byte, error)

func (*Vm) ReleaseResponseChan

func (vm *Vm) ReleaseResponseChan(ch chan *types.VmResponse)

func (*Vm) ReleaseVm

func (vm *Vm) ReleaseVm() error

func (*Vm) RemoveContainer added in v0.8.0

func (vm *Vm) RemoveContainer(id string) api.Result

func (*Vm) RemoveContainers added in v0.8.0

func (vm *Vm) RemoveContainers(ids ...string) (bool, map[string]api.Result)

func (*Vm) RemoveVolume added in v0.8.0

func (vm *Vm) RemoveVolume(name string) api.Result

func (*Vm) RemoveVolumes added in v0.8.0

func (vm *Vm) RemoveVolumes(names ...string) (bool, map[string]api.Result)

func (*Vm) Save

func (vm *Vm) Save(path string) error

func (*Vm) SetCpus

func (vm *Vm) SetCpus(cpus int) error

func (*Vm) Shutdown added in v0.8.0

func (vm *Vm) Shutdown() api.Result

func (*Vm) SignalProcess added in v0.8.0

func (vm *Vm) SignalProcess(container, process string, signal syscall.Signal) error

func (*Vm) StartContainer added in v0.8.0

func (vm *Vm) StartContainer(id string) error

func (*Vm) Stats

func (vm *Vm) Stats() *types.PodStats

func (*Vm) Tty

func (vm *Vm) Tty(containerId, execId string, row, column int) error

func (*Vm) WaitInit added in v0.8.0

func (vm *Vm) WaitInit() api.Result

func (*Vm) WaitProcess added in v0.8.0

func (vm *Vm) WaitProcess(isContainer bool, ids []string, timeout int) <-chan *api.ProcessExit

func (*Vm) WaitResponse added in v0.8.0

func (vm *Vm) WaitResponse(match matchResponse, timeout int) chan error

func (*Vm) WaitVm added in v0.8.0

func (vm *Vm) WaitVm(timeout int) <-chan error

func (*Vm) WriteFile

func (vm *Vm) WriteFile(container, target string, data []byte) error

type VmContext

type VmContext struct {
	Id string

	PauseState int
	Boot       *BootConfig

	// Communication Context
	Hub chan VmEvent

	DCtx DriverContext

	HomeDir         string
	HyperSockName   string
	TtySockName     string
	ConsoleSockName string
	ShareDir        string
	GuestCid        uint32
	// contains filtered or unexported fields
}

func InitContext

func InitContext(id string, hub chan VmEvent, client chan *types.VmResponse, dc DriverContext, boot *BootConfig) (*VmContext, error)

func VmAssociate

func VmAssociate(vmId string, hub chan VmEvent, client chan *types.VmResponse, pack []byte) (*VmContext, error)

func (*VmContext) AddContainer added in v0.8.0

func (ctx *VmContext) AddContainer(c *api.ContainerDescription, result chan api.Result)

func (*VmContext) AddInterface added in v0.8.0

func (ctx *VmContext) AddInterface(inf *api.InterfaceDescription, result chan api.Result)

func (*VmContext) AddPortmapping added in v0.8.0

func (ctx *VmContext) AddPortmapping(ports []*api.PortDescription)

func (*VmContext) AddVolume added in v0.8.0

func (ctx *VmContext) AddVolume(vol *api.VolumeDescription, result chan api.Result)

func (*VmContext) Become

func (ctx *VmContext) Become(handler stateHandler, desc string)

func (*VmContext) Close

func (ctx *VmContext) Close()

func (*VmContext) DeleteExec added in v0.6.2

func (ctx *VmContext) DeleteExec(id string)

func (*VmContext) IsRunning added in v0.8.1

func (ctx *VmContext) IsRunning() bool

func (*VmContext) Launch added in v0.8.0

func (ctx *VmContext) Launch()

func (*VmContext) Log added in v0.8.0

func (ctx *VmContext) Log(level hlog.LogLevel, args ...interface{})

func (*VmContext) LogLevel added in v0.8.0

func (ctx *VmContext) LogLevel(level hlog.LogLevel) bool

func (*VmContext) LogPrefix added in v0.8.0

func (ctx *VmContext) LogPrefix() string

func (*VmContext) LookupBySession added in v0.6.2

func (ctx *VmContext) LookupBySession(session uint64) string

func (*VmContext) LookupExecBySession added in v0.6.2

func (ctx *VmContext) LookupExecBySession(session uint64) string

func (*VmContext) NextPciAddr added in v0.8.0

func (ctx *VmContext) NextPciAddr() int

func (*VmContext) RemoveContainer added in v0.8.0

func (ctx *VmContext) RemoveContainer(id string, result chan<- api.Result)

func (*VmContext) RemoveInterface added in v0.8.0

func (ctx *VmContext) RemoveInterface(id string, result chan api.Result)

func (*VmContext) RemoveVolume added in v0.8.0

func (ctx *VmContext) RemoveVolume(name string, result chan<- api.Result)

func (*VmContext) SendVmEvent added in v0.8.0

func (ctx *VmContext) SendVmEvent(ev VmEvent) error

SendVmEvent enqueues a VmEvent onto the context. Returns an error if there is no handler associated with the context. VmEvent handling happens in a separate goroutine, so this is thread-safe and asynchronous.

func (*VmContext) SetNetworkEnvironment added in v0.8.0

func (ctx *VmContext) SetNetworkEnvironment(net *api.SandboxConfig)

User API

type VmEvent

type VmEvent interface {
	Event() int
}

type VmExit

type VmExit struct{}

func (*VmExit) Event

func (qe *VmExit) Event() int

type VmHwStatus

type VmHwStatus struct {
	PciAddr  int    //next available pci addr for pci hotplug
	ScsiId   int    //next available scsi id for scsi hotplug
	AttachId uint64 //next available attachId for attached tty
	GuestCid uint32 //vsock guest cid
}

type VmKilledEvent

type VmKilledEvent struct {
	Success bool
}

func (*VmKilledEvent) Event

func (qe *VmKilledEvent) Event() int

type VmStartFailEvent

type VmStartFailEvent struct {
	Message string
}

func (*VmStartFailEvent) Event

func (qe *VmStartFailEvent) Event() int

type VmTimeout

type VmTimeout struct{}

func (*VmTimeout) Event

func (qe *VmTimeout) Event() int

type VolumeInfo

type VolumeInfo struct {
	Name         string //volumen name in spec
	Filepath     string //block dev absolute path, or dir path relative to share dir
	Fstype       string //"xfs", "ext4" etc. for block dev, or "dir" for dir path
	Format       string //"raw" (or "qcow2") for volume, no meaning for dir path
	DockerVolume bool
}

type VolumeUnmounted

type VolumeUnmounted struct {
	Name    string
	Success bool
}

func (*VolumeUnmounted) Event

func (qe *VolumeUnmounted) Event() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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