qemugen

package
v0.0.0-...-ede35a2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package qemugen translates the high level concepts used by Machina into concrete virtual machine descriptions use by QEMU. It generates QEMU virtual machine definitions from Machina virtual machine definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(m machina.Machine, sys machina.System) (qvm.Definition, error)

Build prepares a QEMU virtual machine definition for the given machina machine and system configuration.

Types

type StorageHandler

type StorageHandler interface {
	NodeName(spec VolumeSpec) blockdev.NodeName
	Apply(VolumeSpec, Target) error
}

StorageHandler is an interface that can interpret volume specifications for a particular storage type.

type StorageHandlerMap

type StorageHandlerMap map[machina.StorageType]StorageHandler

StorageHandlerMap maps storage types to storage handlers that are capable of adding storage to QEMU virtual machine definitions.

func DefaultStorageHandlers

func DefaultStorageHandlers() StorageHandlerMap

DefaultStorageHandlers returns the set of default storage handlers provided by the machina library.

func (StorageHandlerMap) Apply

func (m StorageHandlerMap) Apply(spec VolumeSpec, t Target) error

Apply applies the given volume specification to the virtual machine. If successful, it returns the block device node name that backs the volume.

func (StorageHandlerMap) NodeName

func (m StorageHandlerMap) NodeName(spec VolumeSpec) (blockdev.NodeName, error)

NodeName returns the node name that would be assigned to for the given volume specification.

type Target

type Target struct {
	VM          *qvm.Definition
	Controllers *qdev.ControllerMap
	BootOrder   *qdev.BootOrder
}

Target holds information about the target QEMU virtual machine that is being generated.

type VolumeSpec

type VolumeSpec struct {
	Machine machina.MachineInfo
	Vars    machina.Vars
	Volume  machina.Volume
	Storage machina.Storage
}

VolumeSpec describes a volume within a storage pool.

func (VolumeSpec) VolumePath

func (spec VolumeSpec) VolumePath() machina.VolumePath

VolumePath returns the path of the volume within the storage pool.

Jump to

Keyboard shortcuts

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