libvirts

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DATASTOR = DataStoreMgr{
	Storage: make([]DataStore, 0, 32),
}
View Source
var ISO = IsoMgr{
	Files: make([]IsoFile, 0, 32),
}

Functions

func AddHyperListener

func AddHyperListener(listen HyperListener)

func IsDomainPool

func IsDomainPool(name string) bool

func RemovePool

func RemovePool(name string) error

func RemoveVolume

func RemoveVolume(pool string, name string) error

func ToDomainPool

func ToDomainPool(domain string) 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 CapacityXML

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

type DataStore

type DataStore struct {
	Name       string `json:"name"`
	Path       string `json:"path"`
	State      int    `json:"state"`
	Capacity   uint64 `json:"capacity"`
	Allocation uint64 `json:"allocation"`
	Available  uint64 `json:"available"`
}

type DataStoreMgr

type DataStoreMgr struct {
	Storage []DataStore `json:"storage"`
}

func (*DataStoreMgr) Init

func (store *DataStoreMgr) Init()

func (*DataStoreMgr) List

func (store *DataStoreMgr) List() []DataStore

type FormatXML

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

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) Open

func (h *HyperVisor) Open() error

type IsoFile

type IsoFile struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

type IsoMgr

type IsoMgr struct {
	Files []IsoFile `json:"files"`
}

func (*IsoMgr) ListFiles

func (iso *IsoMgr) ListFiles(dir string) []IsoFile

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 {
	Type string
	Name string
	Size uint64
	Path string
}

func CreatePool

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

func NewPool

func NewPool(name, target string) Pool

func (*Pool) Create

func (pol *Pool) Create() 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     string        `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"`
}

func (*PoolXML) Decode

func (pol *PoolXML) Decode(xmlData string) error

func (*PoolXML) Encode

func (pol *PoolXML) Encode() string

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 {
	Pool     string
	Name     string
	Size     uint64
	Format   string
	BackFile string
}

func CreateVolume

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

func NewVolume

func NewVolume(pool, name string, size uint64) Volume

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 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"`
}

func (*VolumeXML) Decode

func (vol *VolumeXML) Decode(xmlData string) error

func (*VolumeXML) Encode

func (vol *VolumeXML) Encode() string

Jump to

Keyboard shortcuts

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