virtualbox

package
v0.16.2-gitlab.15-rc2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMachineNotExist = errors.New("machine does not exist")
	ErrVBMNotFound     = errors.New("VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path")
)
View Source
var (
	ErrUnableToGenerateRandomIP = errors.New("unable to generate random IP")
	ErrMustEnableVTX            = errors.New("This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory")
	ErrNotCompatibleWithHyperV  = errors.New("This computer is running Hyper-V. VirtualBox won't boot a 64bits VM when Hyper-V is activated. Either use Hyper-V as a driver, or disable the Hyper-V hypervisor. (To skip this check, use --virtualbox-no-vtx-check)")
	ErrNetworkAddrCidr          = errors.New("host-only cidr must be specified with a host address, not a network address")
	ErrNetworkAddrCollision     = errors.New("host-only cidr conflicts with the network address of a host interface")
)

Functions

This section is empty.

Types

type B2DUpdater

type B2DUpdater interface {
	UpdateISOCache(storePath, isoURL string) error
	CopyIsoToMachineDir(storePath, machineName, isoURL string) error
}

B2DUpdater describes the interactions with b2d.

func NewB2DUpdater

func NewB2DUpdater() B2DUpdater

type DiskCreator

type DiskCreator interface {
	Create(size int, publicSSHKeyPath, diskPath string) error
}

func NewDiskCreator

func NewDiskCreator() DiskCreator

type Driver

type Driver struct {
	*drivers.BaseDriver
	VBoxManager
	HostInterfaces

	CPU                 int
	Memory              int
	DiskSize            int
	NatNicType          string
	Boot2DockerURL      string
	Boot2DockerImportVM string
	HostDNSResolver     bool
	HostOnlyCIDR        string
	HostOnlyNicType     string
	HostOnlyPromiscMode string
	UIType              string
	HostOnlyNoDHCP      bool
	NoShare             bool
	DNSProxy            bool
	NoVTXCheck          bool
	ShareFolder         string
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(hostName, storePath string) *Driver

NewDriver creates a new VirtualBox driver with default settings.

func (*Driver) Create

func (d *Driver) Create() error

func (*Driver) CreateVM

func (d *Driver) CreateVM() error

func (*Driver) DriverName

func (d *Driver) DriverName() string

DriverName returns the name of the driver

func (*Driver) GetCreateFlags

func (d *Driver) GetCreateFlags() []mcnflag.Flag

GetCreateFlags registers the flags this driver adds to "docker hosts create"

func (*Driver) GetIP

func (d *Driver) GetIP() (string, error)

func (*Driver) GetSSHHostname

func (d *Driver) GetSSHHostname() (string, error)

func (*Driver) GetSSHUsername

func (d *Driver) GetSSHUsername() string

func (*Driver) GetState

func (d *Driver) GetState() (state.State, error)

func (*Driver) GetURL

func (d *Driver) GetURL() (string, error)

func (*Driver) IsVTXDisabled

func (d *Driver) IsVTXDisabled() bool

IsVTXDisabled checks if VT-x is disabled in the CPU.

func (*Driver) IsVTXDisabledInTheVM

func (d *Driver) IsVTXDisabledInTheVM() (bool, error)

IsVTXDisabledInTheVM checks if VT-X is disabled in the started vm.

func (*Driver) Kill

func (d *Driver) Kill() error

func (*Driver) PreCreateCheck

func (d *Driver) PreCreateCheck() error

PreCreateCheck checks that VBoxManage exists and works

func (*Driver) Remove

func (d *Driver) Remove() error

func (*Driver) Restart

func (d *Driver) Restart() error

Restart restarts a machine which is known to be running.

func (*Driver) SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error

func (*Driver) Start

func (d *Driver) Start() error

func (*Driver) Stop

func (d *Driver) Stop() error

type HostInterfaces

type HostInterfaces interface {
	Interfaces() ([]net.Interface, error)
	Addrs(iface *net.Interface) ([]net.Addr, error)
}

HostInterfaces returns host network interface info. By default delegates to net.Interfaces()

func NewHostInterfaces

func NewHostInterfaces() HostInterfaces

type IPWaiter

type IPWaiter interface {
	Wait(d *Driver) error
}

IPWaiter waits for an IP to be configured.

func NewIPWaiter

func NewIPWaiter() IPWaiter

type LogsReader

type LogsReader interface {
	Read(path string) ([]string, error)
}

LogsReader describes the reading of VBox.log

func NewLogsReader

func NewLogsReader() LogsReader

type RandomInter

type RandomInter interface {
	RandomInt(n int) int
}

RandomInter returns random int values.

func NewRandomInter

func NewRandomInter() RandomInter

type SSHKeyGenerator

type SSHKeyGenerator interface {
	Generate(path string) error
}

SSHKeyGenerator describes the generation of ssh keys.

func NewSSHKeyGenerator

func NewSSHKeyGenerator() SSHKeyGenerator

type Sleeper

type Sleeper interface {
	Sleep(d time.Duration)
}

Sleeper sleeps for given duration.

func NewSleeper

func NewSleeper() Sleeper

type VBoxCmdManager

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

VBoxCmdManager communicates with VirtualBox through the commandline using `VBoxManage`.

func NewVBoxManager

func NewVBoxManager() *VBoxCmdManager

NewVBoxManager creates a VBoxManager instance.

type VBoxManager

type VBoxManager interface {
	// contains filtered or unexported methods
}

VBoxManager defines the interface to communicate to VirtualBox.

type VM

type VM struct {
	CPUs   int
	Memory int
}

type VirtualDisk

type VirtualDisk struct {
	UUID string
	Path string
}

Jump to

Keyboard shortcuts

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