Documentation ¶
Index ¶
- Constants
- Variables
- type DomainState
- type LibvirtConnect
- func (lc *LibvirtConnect) DefineDomain(dxml *libvirtxml.Domain) (*LibvirtDomain, error)
- func (lc *LibvirtConnect) GetDomainByName(name string) (*LibvirtDomain, error)
- func (lc *LibvirtConnect) GetDomainByUUIDString(uuid string) (*LibvirtDomain, error)
- func (lc *LibvirtConnect) ListDomains() ([]*LibvirtDomain, error)
- type LibvirtDomain
- func (ld *LibvirtDomain) Create() error
- func (ld *LibvirtDomain) Destroy() error
- func (ld *LibvirtDomain) GetName() (string, error)
- func (ld *LibvirtDomain) GetState() (DomainState, error)
- func (ld *LibvirtDomain) GetUUIDString() (string, error)
- func (ld *LibvirtDomain) Shutdown() error
- func (ld *LibvirtDomain) Undefine() error
- type VMInfo
- type VMSetting
- type VMTool
- func (vt *VMTool) CreateContainer(ctrMeta *metadata.ContainerMetadata, sbMeta *metadata.SandboxMetadata) error
- func (vt *VMTool) GetVMInfo(domainID string) (*VMInfo, error)
- func (vt *VMTool) ListVMs() (map[string]*VMInfo, error)
- func (vt *VMTool) RemoveVM(domainID string) error
- func (vt *VMTool) StartVM(domainID string) error
- func (vt *VMTool) StopVM(domainID string, timeout int64) error
Constants ¶
const ( // Default maximum memory limitation for VM DefaultMaxMem = 32768 // size in MiB // Default maximum cpu cores limitation for VM DefaultMaxCPUs = 8 )
Variables ¶
var ErrDomainNotFound = errors.New("domain not found")
ErrDomainNotFound err means can't find specified domain returned by domain loop up methods
Functions ¶
This section is empty.
Types ¶
type DomainState ¶
type DomainState int
DomainState represents a state of a libvirt domain
const ( // DOMAIN_NOSTATE represents the domain is in no state DOMAIN_NOSTATE DomainState = iota // DOMAIN_RUNNING represents that the domain is running DOMAIN_RUNNING // DOMAIN_BLOCKED represents that the domain is blocked DOMAIN_BLOCKED // DOMAIN_PAUSED represents that the domain is paused DOMAIN_PAUSED // DOMAIN_SHUTDOWN represents that the domain is being shut down DOMAIN_SHUTDOWN // DOMAIN_CRASHED represents that the domain is crashed DOMAIN_CRASHED // DOMAIN_PMSUSPENDED represents that the domain is suspended DOMAIN_PMSUSPENDED // DOMAIN_SHUTOFF represents that the domain is shut off DOMAIN_SHUTOFF )
NOTE: Keep same with github.com/libvirt/libvirt-go/domain.go
type LibvirtConnect ¶
type LibvirtConnect struct { }
LibvirtConnect is a wrapper for libvirt connection
func NewLibvirtConnect ¶
func NewLibvirtConnect(uri string) (*LibvirtConnect, error)
NewLibvirtConnect create LibvirtConnect by libvirt uri
func (*LibvirtConnect) DefineDomain ¶
func (lc *LibvirtConnect) DefineDomain(dxml *libvirtxml.Domain) (*LibvirtDomain, error)
DefineDomain define domain with domain setting xml
func (*LibvirtConnect) GetDomainByName ¶
func (lc *LibvirtConnect) GetDomainByName(name string) (*LibvirtDomain, error)
GetDomainByName get domain from libvirt by domian name
func (*LibvirtConnect) GetDomainByUUIDString ¶
func (lc *LibvirtConnect) GetDomainByUUIDString(uuid string) (*LibvirtDomain, error)
GetDomainByUUIDString get domain from libvirt by domain UUID
func (*LibvirtConnect) ListDomains ¶
func (lc *LibvirtConnect) ListDomains() ([]*LibvirtDomain, error)
ListDomains get all domains managed by libvirt, including those not managed by unikernel runtime.
type LibvirtDomain ¶
type LibvirtDomain struct { }
LibvirtDomain is a wrapper for libvirt-go Domain
func (*LibvirtDomain) Create ¶
func (ld *LibvirtDomain) Create() error
Create creates libvirt domain
func (*LibvirtDomain) Destroy ¶
func (ld *LibvirtDomain) Destroy() error
Destroy destroy libvirt domain
func (*LibvirtDomain) GetName ¶
func (ld *LibvirtDomain) GetName() (string, error)
GetName gets name of libvirt domain
func (*LibvirtDomain) GetState ¶
func (ld *LibvirtDomain) GetState() (DomainState, error)
GetState get domain state
func (*LibvirtDomain) GetUUIDString ¶
func (ld *LibvirtDomain) GetUUIDString() (string, error)
GetUUIDString return uuid of libvirt domain
func (*LibvirtDomain) Shutdown ¶
func (ld *LibvirtDomain) Shutdown() error
Shutdown shutdown libvirt domain
func (*LibvirtDomain) Undefine ¶
func (ld *LibvirtDomain) Undefine() error
Undefine undefines libvirt domain
type VMInfo ¶
type VMInfo struct { UUID string State DomainState }
type VMTool ¶
type VMTool struct {
// contains filtered or unexported fields
}
func NewVMTool ¶
func NewVMTool(conn *LibvirtConnect, enableLog bool) *VMTool
func (*VMTool) CreateContainer ¶
func (vt *VMTool) CreateContainer(ctrMeta *metadata.ContainerMetadata, sbMeta *metadata.SandboxMetadata) error
NOTE(Crazykev): This method may be changed when support multiple container per Pod. CreateContainer creates VM which contains container defined in container spec