driver

package
v0.4.1-73-g22cdef1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnknownDriver driver is used to indicate an unknown or misspecified driver
	UnknownDriver = DriverType("unknown")

	// QemuDriver is the QEMU hypervisor
	QemuDriver = DriverType("qemu")
)
View Source
const KvmPath = "/dev/kvm"

Variables

This section is empty.

Functions

func DriverNames

func DriverNames() []string

DriverNameToType

func IsQemuKVM

func IsQemuKVM() (bool, error)

Types

type Driver

type Driver interface {
	// Create a machine using this driver with the defined `MachineOption`s.
	Create(context.Context, ...machine.MachineOption) (machine.MachineID, error)

	// Start requests the machine to begin its execution if paused.
	Start(context.Context, machine.MachineID) error

	// Stop requests the machine to stop its execution if running.
	Stop(context.Context, machine.MachineID) error

	// Wait for the machine to complete its execution if running.
	Wait(context.Context, machine.MachineID) (int, time.Time, error)

	// StartAndWait starts the machine and then waits for the machine to exit
	// before returning.
	StartAndWait(context.Context, machine.MachineID) (int, time.Time, error)

	// Pid returns the process ID of the machine VMM
	Pid(ctx context.Context, mid machine.MachineID) (uint32, error)

	// Pause a machine given its MachineID.
	Pause(context.Context, machine.MachineID) error

	// Destroy a machine given its MachineID.
	Destroy(context.Context, machine.MachineID) error

	// Tail the serial console of the machine by providing.
	TailWriter(context.Context, machine.MachineID, io.Writer) error

	// List all machines supervised by the current driver.
	List(context.Context) ([]machine.MachineID, error)

	// State returns the machine state given a MachineID.
	State(context.Context, machine.MachineID) (machine.MachineState, error)

	// Shutdown sends a shutdown signal to the machine given a MachineID.
	Shutdown(context.Context, machine.MachineID) error

	// ListenStatusUpdate returns two channels, one for receiving the state of a
	// machine and any live errors.  This can be used to monitor a given machine
	// by its MachineID.  The method returns the last error if the channels cannot
	// be initialized.
	ListenStatusUpdate(context.Context, machine.MachineID) (chan machine.MachineState, chan error, error)
}

Driver represents the interface necessary to be implemented to manage the lifcycle of a machine.

func New

func New(driverType DriverType, opts ...driveropts.DriverOption) (driver Driver, err error)

New creates an instantiated driver which can create and manage the lifecycle of a machine. The returning interface is implemented by the driver.

type DriverType

type DriverType string

func DetectHostHypervisor

func DetectHostHypervisor() (DriverType, error)

func DriverTypeFromName

func DriverTypeFromName(name string) DriverType

func (DriverType) String

func (dt DriverType) String() string

type IsHypervisor

type IsHypervisor func() (bool, error)

Jump to

Keyboard shortcuts

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