hyper

package
v0.0.0-...-a9890c3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDesiredState

func ApplyDesiredState(c *libvirt.Connect, uuid string, desiredState hyperAPI.PowerState) error

ApplyDesiredState takes in the desired state of the VM and attempts to apply the desired state

func AvailableDisks

func AvailableDisks() ([]string, error)

AvailableDisks lists available disks

func DefineVM

func DefineVM(c *libvirt.Connect, vm *hyperAPI.VM) error

DefineVM takes in an API desc and creates a hypervisor accepted VM

func List

func List(c *libvirt.Connect)

List provides a list of running VMs

func NewLocalLibVirtConn

func NewLocalLibVirtConn() (*libvirt.Connect, error)

NewLocalLibVirtConn connects to the local libvirt daemon

func Snapshot

func Snapshot(d *libvirt.Domain) error

Snapshot attempts to create a snapshot of a running VM

func Stats

func Stats(c *libvirt.Connect, uuid string) error

Stats gets a current running VM's io/resource stats

Types

type DomainBackup

type DomainBackup struct {
	XMLName xml.Name `xml:"domainbackup"`
	Mode    string   `xml:"mode,attr,omitempty"`

	Disks       []DomainBackupDisk `xml:"disks>disk"`
	Incremental uint64             `xml:"incremental,omitempty"`
}

DomainBackup Backup

type DomainBackupDisk

type DomainBackupDisk struct {
	XMLName xml.Name `xml:"disk"`
	Name    string   `xml:"name,attr"`
	Type    string   `xml:"type,attr"`

	Backup       string `xml:"backup,attr,omitempty"`
	ExportName   string `xml:"exportname,attr,omitempty"`
	ExportBitmap string `xml:"exportbitmap,attr,omitempty"`

	Driver DomainBackupDiskDriver `xml:"driver"`
	Target DomainBackupDiskTarget `xml:"target"`
}

DomainBackupDisk Backup Disk

type DomainBackupDiskDriver

type DomainBackupDiskDriver struct {
	Name string `xml:"name,attr,omitempty"`
	Type string `xml:"type,attr"`
}

DomainBackupDiskDriver Backup Disk Driver

type DomainBackupDiskTarget

type DomainBackupDiskTarget struct {
	File     string `xml:"file,attr,omitempty"`
	Protocol string `xml:"protocol,attr,omitempty"`

	Host *DomainBackupDiskTargetHost `xml:"host,omitempty"`
}

DomainBackupDiskTarget Backup Disk Target

type DomainBackupDiskTargetHost

type DomainBackupDiskTargetHost struct {
	Text string `xml:",chardata"`
	Name string `xml:"name,attr,omitempty"`
	Port string `xml:"port,attr,omitempty"`
}

DomainBackupDiskTargetHost Backup Disk Target Host

type DomainBlkIOTuneDevice

type DomainBlkIOTuneDevice struct {
	Path   string `xml:"path"`
	Weight int    `xml:"weight,omitempty"`

	ReadBytesSec  uint32 `xml:"read_bytes_sec,omitempty"`
	WriteBytesSec uint32 `xml:"write_bytes_sec,omitempty"`
	ReadIOPsSec   uint32 `xml:"read_iops_sec,omitempty"`
	WriteIOPsSec  uint32 `xml:"write_iops_sec,omitempty"`
}

DomainBlkIOTuneDevice Device level Block IO tuning

type DomainBlockIOTune

type DomainBlockIOTune struct {
	Weight int `xml:"weight,omitempty"`

	Devices []DomainBlkIOTuneDevice `xml:"device"`
}

DomainBlockIOTune Block IO Tune

type DomainCPU

type DomainCPU struct {
	Mode  string `xml:"mode,attr"`
	Check string `xml:"check,attr"`
}

DomainCPU CPU

type DomainChannel

type DomainChannel struct {
	Type string `xml:"type,attr"`

	Target DomainChannelTarget `xml:"target"`

	Address DomainDeviceAddr `xml:"address"`
}

DomainChannel Channel

type DomainChannelTarget

type DomainChannelTarget struct {
	Type string `xml:"type,attr"`
	Name string `xml:"name,attr"`
}

DomainChannelTarget Channel Target

type DomainCheckpoint

type DomainCheckpoint struct {
	XMLName     xml.Name `xml:"domaincheckpoint"`
	Description string   `xml:"description"`

	Disks []DomainCheckpointDisk `xml:"disks>disk"`
}

DomainCheckpoint Checkpoint

type DomainCheckpointDisk

type DomainCheckpointDisk struct {
	XMLName    xml.Name `xml:"disk"`
	Name       string   `xml:"name,attr"`
	Checkpoint string   `xml:"checkpoint,attr,omitempty"`
	Bitmap     string   `xml:"bitmap,attr,omitempty"`
}

DomainCheckpointDisk Checkpoint Disk

type DomainClock

type DomainClock struct {
	Offset string             `xml:"offset,attr"`
	Timer  []DomainClockTimer `xml:"timer"`
}

DomainClock Clock

type DomainClockTimer

type DomainClockTimer struct {
	Name       string `xml:"name,attr"`
	Tickpolicy string `xml:"tickpolicy,attr,omitempty"`
	Present    string `xml:"present,attr,omitempty"`
}

DomainClockTimer Clock Timer

type DomainConsole

type DomainConsole struct {
	Type string `xml:"type,attr"`

	Target DomainConsoleTarget `xml:"target"`
}

DomainConsole Console

type DomainConsoleTarget

type DomainConsoleTarget struct {
	Type string `xml:"type,attr"`
	Port int    `xml:"port,attr"`
}

DomainConsoleTarget Console Target

type DomainController

type DomainController struct {
	Type      string `xml:"type,attr"`
	Index     string `xml:"index,attr"`
	ModelAttr string `xml:"model,attr,omitempty"`

	Master *DomainControllerMaster `xml:"master,omitempty"`
	Model  *DomainControllerModel  `xml:"model,omitempty"`
	Target *DomainControllerTarget `xml:"target,omitempty"`

	Address *DomainDeviceAddr `xml:"address"`
}

DomainController Controller

type DomainControllerMaster

type DomainControllerMaster struct {
	Startport string `xml:"startport,attr,omitempty"`
}

DomainControllerMaster Controller Master

type DomainControllerModel

type DomainControllerModel struct {
	Name string `xml:"name,attr,omitempty"`
}

DomainControllerModel Controller Model

type DomainControllerTarget

type DomainControllerTarget struct {
	Chassis string `xml:"chassis,attr,omitempty"`
	Port    string `xml:"port,attr,omitempty"`
}

DomainControllerTarget Controller Target

type DomainDesc

type DomainDesc struct {
	XMLName  xml.Name       `xml:"domain"`
	Type     string         `xml:"type,attr"`
	Name     string         `xml:"name"`
	UUID     string         `xml:"uuid,omtiempty"`
	Metadata DomainMetadata `xml:"metadata"`

	OnPoweroff string `xml:"on_poweroff"`
	OnReboot   string `xml:"on_reboot"`
	OnCrash    string `xml:"on_crash"`

	OS       DomainOS       `xml:"os"`
	Features DomainFeatures `xml:"features"`

	Memory        DomainMemory       `xml:"memory"`
	CurrentMemory *DomainMemory      `xml:"currentMemory,omitempty"`
	VCPU          DomainVCPU         `xml:"vcpu"`
	CPU           DomainCPU          `xml:"cpu"`
	Clock         DomainClock        `xml:"clock"`
	Blkiotune     *DomainBlockIOTune `xml:"blkiotune,omitempty"`

	PowerManagement DomainPM `xml:"pm"`

	Devices DomainDevices `xml:"devices"`
}

DomainDesc main domain description

func GetTemplate

func GetTemplate(vm *hyperAPI.VM) (*DomainDesc, error)

GetTemplate converts the VM desc template to a DomainDesc struct

type DomainDeviceAddr

type DomainDeviceAddr struct {
	Type     string `xml:"type,attr,omitempty"`
	Domain   string `xml:"domain,attr,omitempty"`
	Bus      string `xml:"bus,attr,omitempty"`
	Slot     string `xml:"slot,attr,omitempty"`
	Function string `xml:"function,attr,omitempty"`
}

DomainDeviceAddr Device Addr

type DomainDevices

type DomainDevices struct {
	Emulator string `xml:"emulator"`

	Disks       []DomainDisk        `xml:"disk"`
	Console     []DomainConsole     `xml:"console"`
	Serial      []DomainSerial      `xml:"serial"`
	Controllers []DomainController  `xml:"controller"`
	Channel     []DomainChannel     `xml:"channel"`
	Input       []DomainInput       `xml:"input,omitempty"`
	Graphics    []DomainGraphics    `xml:"graphics,omitempty"`
	Video       []DomainVideo       `xml:"video,omitempty"`
	Rng         []DomainRNG         `xml:"rng"`
	MemBalloon  DomainMemoryBalloon `xml:"memballoon"`
}

DomainDevices Devices

type DomainDisk

type DomainDisk struct {
	XMLName  xml.Name            `xml:"disk"`
	Type     string              `xml:"type,attr"`
	Device   string              `xml:"device,attr"`
	ReadOnly *DomainDiskReadOnly `xml:"readonly"`
	IOTune   *DomainDiskIOTune   `xml:"iotune"`

	Driver       DomainDiskDriver        `xml:"driver"`
	Source       DomainDiskSource        `xml:"source"`
	BackingStore *DomainDiskBackingStore `xml:"backingStore,omitempty"`
	Target       DomainDiskTarget        `xml:"target"`
	Address      DomainDeviceAddr        `xml:"address"`
}

DomainDisk Disk

type DomainDiskBackingStore

type DomainDiskBackingStore struct {
}

DomainDiskBackingStore Disk Backing Store

type DomainDiskDriver

type DomainDiskDriver struct {
	Name string `xml:"name,attr"`
	Type string `xml:"type,attr"`
}

DomainDiskDriver Disk Driver

type DomainDiskIOTune

type DomainDiskIOTune struct {
	TotalBytesSec    uint64 `xml:"total_bytes_sec,omitempty"`
	ReadBytesSec     uint64 `xml:"read_bytes_sec,omitempty"`
	WriteBytesSec    uint64 `xml:"write_bytes_sec,omitempty"`
	TotalIopsSec     uint64 `xml:"total_iops_sec,omitempty"`
	ReadIopsSec      uint64 `xml:"read_iops_sec,omitempty"`
	WriteIopsSec     uint64 `xml:"write_iops_sec,omitempty"`
	TotalBytesSecMax uint64 `xml:"total_bytes_sec_max,omitempty"`
	ReadBytesSecMax  uint64 `xml:"read_bytes_sec_max,omitempty"`
	WriteBytesSecMax uint64 `xml:"write_bytes_sec_max,omitempty"`
	TotalIopsSecMax  uint64 `xml:"total_iops_sec_max,omitempty"`
	ReadIopsSecMax   uint64 `xml:"read_iops_sec_max,omitempty"`
	WriteIopsSecMax  uint64 `xml:"write_iops_sec_max,omitempty"`
	SizeIopsSec      uint64 `xml:"size_iops_sec,omitempty"`

	GroupName uint64 `xml:"group_name,omitempty"`

	TotalBytesSecMaxLength uint64 `xml:"total_bytes_sec_max_length,omitempty"`
	ReadBytesSecMaxLength  uint64 `xml:"read_bytes_sec_max_length,omitempty"`
	WriteBytesSecMaxLength uint64 `xml:"write_bytes_sec_max_length,omitempty"`
	TotalIopsSecMaxLength  uint64 `xml:"total_iops_sec_max_length,omitempty"`
	ReadIopsSecMaxLength   uint64 `xml:"read_iops_sec_max_length,omitempty"`
	WriteIopsSecMaxLength  uint64 `xml:"write_iops_sec_max_length,omitempty"`
}

DomainDiskIOTune Disk IO Tune

type DomainDiskReadOnly

type DomainDiskReadOnly struct {
	XMLName xml.Name `xml:"readonly"`
}

DomainDiskReadOnly Disk Read Only

type DomainDiskSource

type DomainDiskSource struct {
	Name          string `xml:"name,attr,omitempty"`
	File          string `xml:"file,attr,omitempty"`
	StartupPolicy string `xml:"startupPolicy,attr,omitempty"`
	Protocol      string `xml:"protocol,attr,omitempty"`

	Host *DomainDiskSourceHost `xml:"host,omitempty"`
}

DomainDiskSource Disk Source

type DomainDiskSourceHost

type DomainDiskSourceHost struct {
	Text string `xml:",chardata"`
	Name string `xml:"name,attr,omitempty"`
	Port string `xml:"port,attr,omitempty"`
}

DomainDiskSourceHost Disk Source Host

type DomainDiskTarget

type DomainDiskTarget struct {
	Dev string `xml:"dev,attr"`
	Bus string `xml:"bus,attr"`
}

DomainDiskTarget Disk Target

type DomainFeatureAcpi

type DomainFeatureAcpi struct{}

DomainFeatureAcpi Feature ACPI

type DomainFeatureApic

type DomainFeatureApic struct{}

DomainFeatureApic Feature APIC

type DomainFeatureVmport

type DomainFeatureVmport struct {
	State string `xml:"state,attr"`
}

DomainFeatureVmport VMWare IO port support

type DomainFeatures

type DomainFeatures struct {
	Acpi   *DomainFeatureAcpi  `xml:"acpi"`
	Apic   *DomainFeatureApic  `xml:"apic"`
	Vmport DomainFeatureVmport `xml:"vmport"`
}

DomainFeatures Hypervisor Features

type DomainGraphics

type DomainGraphics struct {
	Type     string `xml:"type,attr"`
	Autoport string `xml:"autoport,attr"`

	Listen DomainGraphicsListen `xml:"listen"`
	Image  DomainGraphicsImage  `xml:"image"`
}

DomainGraphics Graphics

type DomainGraphicsImage

type DomainGraphicsImage struct {
	Text        string `xml:",chardata"`
	Compression string `xml:"compression,attr"`
}

DomainGraphicsImage Graphics Image

type DomainGraphicsListen

type DomainGraphicsListen struct {
	Text string `xml:",chardata"`
	Type string `xml:"type,attr"`
}

DomainGraphicsListen Graphics Listen

type DomainInput

type DomainInput struct {
	Type    string            `xml:"type,attr"`
	Bus     string            `xml:"bus,attr"`
	Address *DomainDeviceAddr `xml:"address"`
}

DomainInput Input

type DomainInterface

type DomainInterface struct {
	Type string `xml:"type,attr"`

	Mac DomainInterfaceMac `xml:"mac"`

	Address DomainDeviceAddr `xml:"address"`
}

DomainInterface Interface

type DomainInterfaceMac

type DomainInterfaceMac struct {
	Address net.HardwareAddr `xml:"address,attr"`
}

DomainInterfaceMac Interface Mac

type DomainMemory

type DomainMemory struct {
	Amount uint64 `xml:",chardata"`
	Unit   string `xml:"unit,attr"`
}

DomainMemory Memory

type DomainMemoryBalloon

type DomainMemoryBalloon struct {
	Model   string           `xml:"model,attr"`
	Address DomainDeviceAddr `xml:"address"`
}

DomainMemoryBalloon Memory Balloon

type DomainMetadata

type DomainMetadata struct {
	Text string `xml:",innerxml"`
}

DomainMetadata main domain metadata

type DomainOS

type DomainOS struct {
	Type DomainOSType `xml:"type"`
	Boot DomainOSBoot `xml:"boot"`
}

DomainOS OS

type DomainOSBoot

type DomainOSBoot struct {
	Dev string `xml:"dev,attr"`
}

DomainOSBoot OS Boot Device

type DomainOSType

type DomainOSType struct {
	Type    string `xml:",chardata"`
	Arch    string `xml:"arch,attr"`
	Machine string `xml:"machine,attr"`
}

DomainOSType OS Type

type DomainPM

type DomainPM struct {
	SuspendToMem  DomainPMSuspendType `xml:"suspend-to-mem"`
	SuspendToDisk DomainPMSuspendType `xml:"suspend-to-disk"`
}

DomainPM Power Management

type DomainPMSuspendType

type DomainPMSuspendType struct {
	Enabled string `xml:"enabled,attr"`
}

DomainPMSuspendType PM Suspend Type

type DomainRNG

type DomainRNG struct {
	Model   string           `xml:"model,attr"`
	Backend DomainRNGBackend `xml:"backend"`

	Address DomainDeviceAddr `xml:"address"`
}

DomainRNG RNG (Random Number Generator)

type DomainRNGBackend

type DomainRNGBackend struct {
	Text  string `xml:",chardata"`
	Model string `xml:"model,attr"`
}

DomainRNGBackend RNG Backend

type DomainSerial

type DomainSerial struct {
	Type string `xml:"type,attr"`

	Target DomainSerialTarget `xml:"target"`
}

DomainSerial Serial

type DomainSerialTarget

type DomainSerialTarget struct {
	Type string `xml:"type,attr"`
	Port int    `xml:"port,attr"`

	Model DomainSerialTargetModel `xml:"model"`
}

DomainSerialTarget Serial Target

type DomainSerialTargetModel

type DomainSerialTargetModel struct {
	Name string `xml:"name,attr"`
}

DomainSerialTargetModel Serial Target Model

type DomainVCPU

type DomainVCPU struct {
	Count     uint16 `xml:",chardata"`
	Placement string `xml:"placement,attr,omitempty"`
	CPUSet    string `xml:"cpuset,attr,omitempty"`
}

DomainVCPU VCPU

type DomainVideo

type DomainVideo struct {
	Model   DomainVideoModel `xml:"model"`
	Address DomainDeviceAddr `xml:"address"`
}

DomainVideo Video

type DomainVideoModel

type DomainVideoModel struct {
	Text    string `xml:",chardata"`
	Type    string `xml:"type,attr"`
	RAM     string `xml:"ram,attr"`
	VRAM    string `xml:"vram,attr"`
	Vgamem  string `xml:"vgamem,attr"`
	Heads   string `xml:"heads,attr"`
	Primary string `xml:"primary,attr"`
}

DomainVideoModel Video Model

type InstanceMetadata

type InstanceMetadata struct {
	InstanceID string `json:"instance-id"`
	CloudName  string `json:"cloud-name"`
}

InstanceMetadata basic instance info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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