virtualbox

package
v0.0.0-...-492d7f2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VBOXMANAGE = "/usr/bin/VBoxManage"

VBOXMANAGE is a hardcoded path to VBoxManage to fall back to when it is not in the $PATH.

Functions

func AddNIC

func AddNIC(vm *VM, nic NIC) error

AddNIC adds a NIC to the VM.

func DeleteNIC

func DeleteNIC(vm *VM, nic NIC) error

DeleteNIC deletes the specified network interface on the vm.

func DeleteNICs

func DeleteNICs(vm *VM) error

DeleteNICs disables all the network interfaces on the vm.

func GetBridgedDeviceName

func GetBridgedDeviceName(macAddr string) (string, error)

GetBridgedDeviceName takes the mac address of a network device as a string and returns the name of the network device corresponding to it as seen by Virtualbox

func GetBridgedDeviceNameIPMap

func GetBridgedDeviceNameIPMap() (map[string]string, error)

GetBridgedDeviceNameIPMap returns a map of network device name and its IP address from the list of bridgedifs reported by VirtualBox manager.

func GetBridgedDevices

func GetBridgedDevices() ([]string, error)

GetBridgedDevices returns a slice of network devices that can be connected to VMs in bridged mode

Types

type Backing

type Backing int

Backing represents a backing for VirtualBox NIC

const (
	Nat Backing = iota
	Bridged
	Unsupported
	Disabled
)

Backing information for VirtualBox network cards

type Config

type Config struct {
	NICs []NIC
}

Config represents a config for a VirtualBox VM

type NIC

type NIC struct {
	Idx           int
	Backing       Backing
	BackingDevice string
	// contains filtered or unexported fields
}

NIC represents a Virtualbox NIC

type Runner

type Runner interface {
	Run(args ...string) (string, string, error)
	RunCombinedError(args ...string) (string, error)
}

Runner is an encapsulation around the vmrun utility.

type VM

type VM struct {
	Src string

	Credentials libssh.Credentials
	Name        string
	Config      Config
	// contains filtered or unexported fields
}

VM represents a VirtualBox VM

func (*VM) AddDisk

func (vm *VM) AddDisk() error

func (*VM) Destroy

func (vm *VM) Destroy() error

Destroy powers off the VM and deletes its files from disk.

func (*VM) GetIPs

func (vm *VM) GetIPs() ([]net.IP, error)

GetIPs returns a list of ip addresses associated with the vm through VBox Guest Additions.

func (*VM) GetInterfaces

func (vm *VM) GetInterfaces() ([]NIC, error)

GetInterfaces gets all the network cards attached to this VM

func (*VM) GetName

func (vm *VM) GetName() string

GetName returns the name of the virtual machine

func (*VM) GetSSH

func (vm *VM) GetSSH(options libssh.Options) (libssh.Client, error)

GetSSH returns an ssh client for the the VM.

func (*VM) GetState

func (vm *VM) GetState() (string, error)

GetState gets the power state of the VM being serviced by this driver.

func (*VM) Halt

func (vm *VM) Halt() error

Halt powers off the VM without destroying it

func (*VM) Provision

func (vm *VM) Provision() error

Provision imports the VM and waits until it is booted up.

func (*VM) RemoveDisk

func (vm *VM) RemoveDisk(diskName string) error

func (*VM) Resume

func (vm *VM) Resume() error

Resume restarts the active state of the VM.

func (*VM) Start

func (vm *VM) Start() error

Start powers on the VM

func (*VM) Suspend

func (vm *VM) Suspend() error

Suspend suspends the active state of the VM.

Jump to

Keyboard shortcuts

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