libvirts

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PoolAll = libvirt.CONNECT_LIST_STORAGE_POOLS_ACTIVE | libvirt.CONNECT_LIST_STORAGE_POOLS_INACTIVE
)

Functions

func AddHyperListener

func AddHyperListener(listen HyperListener)

func IsDomainPool

func IsDomainPool(name string) bool

func IsStorePool

func IsStorePool(name string) bool

func PoolState2Str

func PoolState2Str(state libvirt.StoragePoolState) string

func RemoveVolume

func RemoveVolume(pool string, name string) error

func ToDomainPool

func ToDomainPool(domain string) string

func VolumeType

func VolumeType(t libvirt.StorageVolType) string

Types

type AllocationXML

type AllocationXML struct {
	XMLName xml.Name `xml:"allocation" json:"-"`
	Unit    string   `xml:"unit,attr" json:"unit"`
	Value   string   `xml:",chardata" json:"value"`
}

type AvailableXML

type AvailableXML struct {
	XMLName xml.Name `xml:"available" json:"-"`
	Unit    string   `xml:"unit,attr" json:"unit"`
	Value   string   `xml:",chardata" json:"value"`
}

type BackingStoreXML

type BackingStoreXML struct {
	XMLName xml.Name  `xml:"backingStore" json:"-"`
	Path    string    `xml:"path" json:"path"`
	Format  FormatXML `xml:"format" json:"format"`
}

type CapacityXML

type CapacityXML struct {
	XMLName xml.Name `xml:"capacity" json:"-"`
	Unit    string   `xml:"unit,attr" json:"unit"`
	Value   string   `xml:",chardata" json:"value"`
}

type DirXML

type DirXML struct {
	XMLName xml.Name `xml:"dir" json:"-"`
	Path    string   `xml:"path,attr" json:"path"`
}

type FormatXML

type FormatXML struct {
	XMLName xml.Name `xml:"format" json:"-"`
	Type    string   `xml:"type,attr" json:"type"`
}

type HostXML

type HostXML struct {
	XMLName xml.Name `xml:"host" json:"-"`
	Name    string   `xml:"name,attr" json:"name"`
}

type HyperListener

type HyperListener struct {
	Opened func(Conn *libvirt.Connect) error
	Closed func(Conn *libvirt.Connect) error
}

type HyperVisor

type HyperVisor struct {
	Name     string
	Conn     *libvirt.Connect
	Listener []HyperListener
}

func GetHyper

func GetHyper() (*HyperVisor, error)

func SetHyper

func SetHyper(name string) (*HyperVisor, error)

func (*HyperVisor) AddListener

func (h *HyperVisor) AddListener(listen HyperListener)

func (*HyperVisor) Close

func (h *HyperVisor) Close()

func (*HyperVisor) ListAllPools

func (h *HyperVisor) ListAllPools() ([]Pool, error)

func (*HyperVisor) Open

func (h *HyperVisor) Open() error

type PhysicalXML

type PhysicalXML struct {
	XMLName xml.Name `xml:"physical" json:"-"`
	Unit    string   `xml:"unit,attr" json:"unit"`
	Value   string   `xml:",chardata" json:"value"`
}

type Pool

type Pool struct {
	libvirt.StoragePool
	Type string
	Name string
	Size uint64
	Path string
	XML  string
}

func CreatePool

func CreatePool(name, target string) (*Pool, error)

func ListPools

func ListPools() ([]Pool, error)

func LookupPoolByUUID

func LookupPoolByUUID(uuid string) (*Pool, error)

func LookupPoolByUUIDOrName

func LookupPoolByUUIDOrName(uuid string) (*Pool, error)

func NewPoolFromVir

func NewPoolFromVir(pool *libvirt.StoragePool) *Pool

func (*Pool) Clean

func (pol *Pool) Clean() error

func (*Pool) Create

func (pol *Pool) Create() error

func (*Pool) List

func (pol *Pool) List() (map[string]VolumeInfo, error)

func (*Pool) ListByTarget

func (pol *Pool) ListByTarget() (map[string]VolumeInfo, error)

func (*Pool) Remove

func (pol *Pool) Remove() error

type PoolXML

type PoolXML struct {
	XMLName    xml.Name      `xml:"pool" json:"-"`
	Type       string        `xml:"type,attr" json:"type"`
	Name       string        `xml:"name" json:"name"`
	UUID       string        `xml:"uuid" json:"uuid"`
	Source     SourceXML     `xml:"source" json:"source"`
	Capacity   CapacityXML   `xml:"capacity" json:"capacity"`
	Allocation AllocationXML `xml:"allocation" json:"allocation"`
	Available  AvailableXML  `xml:"available" json:"available"`
	Target     TargetXML     `xml:"target" json:"target"`
}

type SourceXML

type SourceXML struct {
	XMLName xml.Name  `xml:"source" json:"-"`
	Host    HostXML   `xml:"host" json:"host"`
	Dir     DirXML    `xml:"dir" json:"dir"`
	Format  FormatXML `xml:"format" json:"format"`
}

type TargetXML

type TargetXML struct {
	XMLName xml.Name  `xml:"target" json:"-"`
	Path    string    `xml:"path" json:"path"`
	Format  FormatXML `xml:"format" json:"format"`
}

type Volume

type Volume struct {
	Path          string
	Pool          string
	Name          string
	Size          uint64
	Format        string
	BackingFile   string
	BackingFormat string
}

func CreateBackingVolume

func CreateBackingVolume(pool, name, backingFle, backingFmt string) (*Volume, error)

func CreateVolume

func CreateVolume(pool, name string, size uint64) (*Volume, error)

func (*Volume) Create

func (vol *Volume) Create() error

func (*Volume) GetXMLObj

func (vol *Volume) GetXMLObj() (*VolumeXML, error)

func (*Volume) Remove

func (vol *Volume) Remove() error

type VolumeInfo

type VolumeInfo struct {
	Pool       string
	Name       string
	Type       string
	Capacity   uint64
	Allocation uint64
}

type VolumeXML

type VolumeXML struct {
	XMLName      xml.Name        `xml:"volume" json:"-"`
	Name         string          `xml:"name" json:"name"`
	Key          string          `xml:"key" json:"key"`
	Source       string          `xml:"source" json:"source"`
	Capacity     CapacityXML     `xml:"capacity" json:"capacity"`
	Allocation   AllocationXML   `xml:"allocation" json:"allocation"`
	Physical     PhysicalXML     `xml:"physical" json:"physical"`
	Target       TargetXML       `xml:"target" json:"target"`
	BackingStore BackingStoreXML `xml:"backingStore" json:"backingStore"`
}

Jump to

Keyboard shortcuts

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