qemu

package
v0.7.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Launch

func Launch() error

Launch a control process around qemu VM manager.

This function is invoked from 'talosctl qemu-launch' hidden command and wraps starting, controlling 'qemu' VM process.

Launch restarts VM forever until control process is stopped itself with a signal.

Process is expected to receive configuration on stdin. Current working directory should be cluster state directory, process output should be redirected to the logfile in state directory.

When signals SIGINT, SIGTERM are received, control process stops qemu and exits.

nolint: gocyclo

func NewProvisioner

func NewProvisioner(ctx context.Context) (provision.Provisioner, error)

NewProvisioner initializes qemu provisioner.

Types

type Arch

type Arch string

Arch abstracts away differences between different architectures.

const (
	ArchAmd64 Arch = "amd64"
	ArchArm64 Arch = "arm64"
)

Arch constants.

func (Arch) Console

func (arch Arch) Console() string

Console defines proper argument for the kernel to send logs to serial console.

func (Arch) PFlash

func (arch Arch) PFlash(uefiEnabled bool) []PFlash

PFlash returns settings for parallel flash.

func (Arch) QemuArch

func (arch Arch) QemuArch() string

QemuArch defines which qemu binary to use.

func (Arch) QemuMachine

func (arch Arch) QemuMachine() string

QemuMachine defines the machine type for qemu.

func (Arch) Valid

func (arch Arch) Valid() bool

Valid checks whether the architecture is supported.

type Controller

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

Controller supports IPMI-like machine control.

func NewController

func NewController() *Controller

NewController initializes controller in "powered on" state.

func (*Controller) CommandsCh

func (c *Controller) CommandsCh() <-chan VMCommand

CommandsCh returns channel with commands.

func (*Controller) ForcePXEBoot

func (c *Controller) ForcePXEBoot() bool

ForcePXEBoot returns whether next boot should be PXE boot.

func (*Controller) PXEBootOnce

func (c *Controller) PXEBootOnce() error

PXEBootOnce implements vm.Controller interface.

func (*Controller) PowerOff

func (c *Controller) PowerOff() error

PowerOff implements vm.Controller interface.

func (*Controller) PowerOn

func (c *Controller) PowerOn() error

PowerOn implements vm.Controller interface.

func (*Controller) PowerState

func (c *Controller) PowerState() PowerState

PowerState returns current power state.

func (*Controller) Reboot

func (c *Controller) Reboot() error

Reboot implements vm.Controller interface.

func (*Controller) Status

func (c *Controller) Status() vm.Status

Status implements vm.Controller interface.

type LaunchConfig

type LaunchConfig struct {
	StatePath string

	// VM options
	DiskPath          string
	VCPUCount         int64
	MemSize           int64
	QemuExecutable    string
	KernelImagePath   string
	InitrdPath        string
	PFlashImages      []string
	KernelArgs        string
	MachineType       string
	EnableKVM         bool
	BootloaderEnabled bool
	NodeUUID          uuid.UUID

	// Talos config
	Config string

	// Network
	NetworkConfig *libcni.NetworkConfigList
	CNI           provision.CNIConfig
	IP            net.IP
	CIDR          net.IPNet
	Hostname      string
	GatewayAddr   net.IP
	MTU           int
	Nameservers   []net.IP

	// PXE
	TFTPServer       string
	BootFilename     string
	IPXEBootFileName string

	// API
	APIPort int
	// contains filtered or unexported fields
}

LaunchConfig is passed in to the Launch function over stdin.

type PFlash

type PFlash struct {
	Size        int64
	SourcePaths []string
}

PFlash for UEFI boot.

type PowerState

type PowerState string

PowerState is current VM power state.

const (
	PoweredOn  PowerState = "on"
	PoweredOff PowerState = "off"
)

Virtual machine power state.

type VMCommand

type VMCommand string

VMCommand is a translated VM command.

const (
	VMCommandStart VMCommand = "start"
	VMCommandStop  VMCommand = "stop"
)

Virtual machine commands.

Jump to

Keyboard shortcuts

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