vbox

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VBoxName = "iotit-box"

	VBoxIP       = "localhost"
	VBoxUser     = "root"
	VBoxPassword = ""
	VBoxSSHPort  = "2222"

	VBoxConfFile = "iotit-vbox.json"
)

VirtualBox location and connection details variables

View Source
const (
	VBoxTypeDefault = iota
	VBoxTypeNew
	VBoxTypeUser
)

vbox types

Variables

This section is empty.

Functions

func CheckMachine

func CheckMachine(machine string) error

CheckMachine checks if any vbox is running with the ability to power-off After that imports and runs the vbox image according to the selected device type

func CheckUpdate

func CheckUpdate() bool

CheckUpdate checks for virtualbox image updates

func CheckVBInstalled

func CheckVBInstalled() error

CheckVBInstalled checks for virtualbox dependencies

func StopMachines

func StopMachines(quiet bool) error

StopMachines stops running machines

func Update

func Update() error

Update virtualbox image

Types

type ArchConfig

type ArchConfig struct {
	CPU    uint          `json:"cpu"`
	Memory uint          `json:"memory"`
	USB    USBController `json:"usb"`
}

ArchConfig represents basic VM settings

type Config

type Config struct {
	Name        string     `json:"name"`
	UUID        string     `json:"uuid"`
	Template    string     `json:"template"`
	Device      string     `json:"device"`
	Description string     `json:"description"`
	Option      ArchConfig `json:"option"`
	SSH         ssh_helper.Util
}

Config represents Vbox parameters with ssh and http configurations

func NewConfig

func NewConfig(device string) *Config

NewConfig returns new VirtualBox wrapper, containing helper functions to copy into vbox and dowload from it Run commands over ssh and get Virtual box configuration files

func (*Config) CPUDialog

func (vc *Config) CPUDialog()

CPUDialog asks for VM CPUs number

func (*Config) DescriptionDialog

func (vc *Config) DescriptionDialog()

DescriptionDialog asks for VM description

func (Config) Enable

func (vc Config) Enable(dst, template, device string) []Config

Enable picks allowed VMs

func (Config) FromJSON

func (vc Config) FromJSON(dst string) []Config

FromJSON reads JSON from file

func (*Config) GetCPU

func (vc *Config) GetCPU() int

GetCPU returns VM CPUs number

func (*Config) GetDescription

func (vc *Config) GetDescription() string

GetDescription returns description of the VM

func (*Config) GetMemory

func (vc *Config) GetMemory() int

GetMemory returns memory size of the VM

func (*Config) GetName

func (vc *Config) GetName() string

GetName returns name of the VM

func (*Config) GetUSBs

func (vc *Config) GetUSBs() (usb, ehci, xhci OnOff)

GetUSBs returns USB settings

func (*Config) GetVbox

func (vc *Config) GetVbox(device string, quiet bool) (*virtualbox.Machine, error)

GetVbox applies default virtualbox specs or create new

func (*Config) Machine

func (vc *Config) Machine() (*virtualbox.Machine, error)

Machine wraps virtualbox.GetMachine

func (*Config) MemoryDialog

func (vc *Config) MemoryDialog()

MemoryDialog asks for VM memory size

func (*Config) Modify

func (vc *Config) Modify() error

Modify applies VM settings

func (*Config) NameDialog

func (vc *Config) NameDialog()

NameDialog asks for VM name

func (*Config) Stop

func (vc *Config) Stop(quiet bool) error

Stop stops VM

func (*Config) ToJSON

func (vc *Config) ToJSON() string

ToJSON returns JSON representation

func (*Config) USBDialog

func (vc *Config) USBDialog()

USBDialog asks for VM USB settings

func (*Config) WriteToFile

func (vc *Config) WriteToFile(dst string)

WriteToFile writes JSON to file

type OnOff

type OnOff bool

OnOff is just a bool with Stringer interface

func (OnOff) String

func (o OnOff) String() string

String returns "on" or "off"

type USBController

type USBController struct {
	USB     OnOff             `json:"vc"`
	USBType USBTypeController `json:"type"`
}

USBController represents USB settings

type USBTypeController

type USBTypeController struct {
	EHCI OnOff `json:"2.0"`
	XHCI OnOff `json:"3.0"`
}

USBTypeController represents USB type settings

Jump to

Keyboard shortcuts

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