vm

package
v0.0.0-...-4cc0894 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Shutdown = make(chan struct{})

Close to interrupt all pending operations.

View Source
var TimeoutErr = errors.New("timeout")

Functions

func LongPipe

func LongPipe() (io.ReadCloser, io.WriteCloser, error)

func MonitorExecution

func MonitorExecution(outc <-chan []byte, errc <-chan error, local, needOutput bool, ignores []*regexp.Regexp) (desc string, text, output []byte, crashed, timedout bool)

func OpenAdbConsole

func OpenAdbConsole(bin, dev string) (rc io.ReadCloser, err error)

OpenAdbConsole provides fallback console output using 'adb shell dmesg -w'.

func OpenConsole

func OpenConsole(con string) (rc io.ReadCloser, err error)

Tested on Suzy-Q and BeagleBone.

func Register

func Register(typ string, ctor ctorFunc)

func SleepInterruptible

func SleepInterruptible(d time.Duration) bool

Sleep for d. If shutdown is in progress, return false prematurely.

Types

type Config

type Config struct {
	Name            string
	Index           int
	Workdir         string
	Bin             string
	BinArgs         string
	Initrd          string
	Kernel          string
	Cmdline         string
	Image           string
	Sshkey          string
	Executor        string
	Device          string
	MachineType     string
	OdroidHostAddr  string
	OdroidSlaveAddr string
	OdroidConsole   string
	OdroidHubBus    int
	OdroidHubDevice int
	OdroidHubPort   int
	Cpu             int
	Mem             int
	Debug           bool
}

type Instance

type Instance interface {
	// Copy copies a hostSrc file into vm and returns file name in vm.
	Copy(hostSrc string) (string, error)

	// Forward setups forwarding from within VM to host port port
	// and returns address to use in VM.
	Forward(port int) (string, error)

	// Run runs cmd inside of the VM (think of ssh cmd).
	// outc receives combined cmd and kernel console output.
	// errc receives either command Wait return error or vm.TimeoutErr.
	// Command is terminated after timeout. Send on the stop chan can be used to terminate it earlier.
	Run(timeout time.Duration, stop <-chan bool, command string) (outc <-chan []byte, errc <-chan error, err error)

	// Close stops and destroys the VM.
	Close()
}

Instance represents a Linux VM or a remote physical machine.

func Create

func Create(typ string, cfg *Config) (Instance, error)

Create creates and boots a new VM instance.

type OutputMerger

type OutputMerger struct {
	Output chan []byte
	Err    chan error
	// contains filtered or unexported fields
}

func NewOutputMerger

func NewOutputMerger(tee io.Writer) *OutputMerger

func (*OutputMerger) Add

func (merger *OutputMerger) Add(name string, r io.ReadCloser)

func (*OutputMerger) Wait

func (merger *OutputMerger) Wait()

Directories

Path Synopsis
Package gce allows to use Google Compute Engine (GCE) virtual machines as VMs.
Package gce allows to use Google Compute Engine (GCE) virtual machines as VMs.

Jump to

Keyboard shortcuts

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