Documentation ¶
Index ¶
- Constants
- func IsDown(domState libvirt.DomainState) bool
- func IsPaused(domState libvirt.DomainState) bool
- type Connection
- type DomainEventDeviceRemoved
- type LibvirtConnection
- func (l *LibvirtConnection) AgentEventLifecycleRegister(callback libvirt.DomainEventAgentLifecycleCallback) (err error)
- func (l *LibvirtConnection) Close() (int, error)
- func (l *LibvirtConnection) DomainDefineXML(xml string) (dom VirDomain, err error)
- func (l *LibvirtConnection) DomainEventDeregister(registrationID int) error
- func (l *LibvirtConnection) DomainEventDeviceAddedRegister(callback libvirt.DomainEventDeviceAddedCallback) (err error)
- func (l *LibvirtConnection) DomainEventDeviceRemovedRegister(callback libvirt.DomainEventDeviceRemovedCallback) (err error)
- func (l *LibvirtConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) (err error)
- func (l *LibvirtConnection) GetAllDomainStats(statsTypes libvirt.DomainStatsTypes, ...) ([]libvirt.DomainStats, error)
- func (l *LibvirtConnection) GetDeviceAliasMap(domain *libvirt.Domain) (map[string]string, error)
- func (l *LibvirtConnection) GetDomainStats(statsTypes libvirt.DomainStatsTypes, migrateJobInfo *stats.DomainJobInfo, ...) ([]*stats.DomainStats, error)
- func (l *LibvirtConnection) ListAllDomains(flags libvirt.ConnectListAllDomainsFlags) ([]VirDomain, error)
- func (l *LibvirtConnection) LookupDomainByName(name string) (dom VirDomain, err error)
- func (l *LibvirtConnection) NewStream(flags libvirt.StreamFlags) (Stream, error)
- func (l *LibvirtConnection) QemuAgentCommand(command string, domainName string) (string, error)
- func (l *LibvirtConnection) SetReconnectChan(reconnect chan bool)
- func (l *LibvirtConnection) VolatileDomainEventDeviceRemovedRegister(domain VirDomain, callback libvirt.DomainEventDeviceRemovedCallback) (int, error)
- type MockConnection
- func (_m *MockConnection) AgentEventLifecycleRegister(callback libvirt.DomainEventAgentLifecycleCallback) error
- func (_m *MockConnection) Close() (int, error)
- func (_m *MockConnection) DomainDefineXML(xml string) (VirDomain, error)
- func (_m *MockConnection) DomainEventDeregister(registrationID int) error
- func (_m *MockConnection) DomainEventDeviceAddedRegister(callback libvirt.DomainEventDeviceAddedCallback) error
- func (_m *MockConnection) DomainEventDeviceRemovedRegister(callback libvirt.DomainEventDeviceRemovedCallback) error
- func (_m *MockConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) error
- func (_m *MockConnection) EXPECT() *_MockConnectionRecorder
- func (_m *MockConnection) GetAllDomainStats(statsTypes libvirt.DomainStatsTypes, ...) ([]libvirt.DomainStats, error)
- func (_m *MockConnection) GetDomainStats(statsTypes libvirt.DomainStatsTypes, l *stats.DomainJobInfo, ...) ([]*stats.DomainStats, error)
- func (_m *MockConnection) ListAllDomains(flags libvirt.ConnectListAllDomainsFlags) ([]VirDomain, error)
- func (_m *MockConnection) LookupDomainByName(name string) (VirDomain, error)
- func (_m *MockConnection) NewStream(flags libvirt.StreamFlags) (Stream, error)
- func (_m *MockConnection) QemuAgentCommand(command string, domainName string) (string, error)
- func (_m *MockConnection) SetReconnectChan(reconnect chan bool)
- func (_m *MockConnection) VolatileDomainEventDeviceRemovedRegister(domain VirDomain, callback libvirt.DomainEventDeviceRemovedCallback) (int, error)
- type MockStream
- type MockVirDomain
- func (_m *MockVirDomain) AbortJob() error
- func (_m *MockVirDomain) AttachDevice(xml string) error
- func (_m *MockVirDomain) AttachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error
- func (_m *MockVirDomain) BlockResize(disk string, size uint64, flags libvirt.DomainBlockResizeFlags) error
- func (_m *MockVirDomain) CoreDumpWithFormat(to string, format libvirt.DomainCoreDumpFormat, ...) error
- func (_m *MockVirDomain) Create() error
- func (_m *MockVirDomain) CreateWithFlags(flags libvirt.DomainCreateFlags) error
- func (_m *MockVirDomain) DestroyFlags(flags libvirt.DomainDestroyFlags) error
- func (_m *MockVirDomain) DetachDevice(xml string) error
- func (_m *MockVirDomain) DetachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error
- func (_m *MockVirDomain) EXPECT() *_MockVirDomainRecorder
- func (_m *MockVirDomain) Free() error
- func (_m *MockVirDomain) GetBlockInfo(disk string, flags uint32) (*libvirt.DomainBlockInfo, error)
- func (_m *MockVirDomain) GetDiskErrors(flags uint32) ([]libvirt.DomainDiskError, error)
- func (_m *MockVirDomain) GetJobInfo() (*libvirt.DomainJobInfo, error)
- func (_m *MockVirDomain) GetJobStats(flags libvirt.DomainGetJobStatsFlags) (*libvirt.DomainJobInfo, error)
- func (_m *MockVirDomain) GetMetadata(tipus libvirt.DomainMetadataType, uri string, ...) (string, error)
- func (_m *MockVirDomain) GetName() (string, error)
- func (_m *MockVirDomain) GetState() (libvirt.DomainState, int, error)
- func (_m *MockVirDomain) GetUUIDString() (string, error)
- func (_m *MockVirDomain) GetXMLDesc(flags libvirt.DomainXMLFlags) (string, error)
- func (_m *MockVirDomain) IsPersistent() (bool, error)
- func (_m *MockVirDomain) MemoryStats(nrStats uint32, flags uint32) ([]libvirt.DomainMemoryStat, error)
- func (_m *MockVirDomain) MigrateStartPostCopy(flags uint32) error
- func (_m *MockVirDomain) MigrateToURI3(_param0 string, _param1 *libvirt.DomainMigrateParameters, ...) error
- func (_m *MockVirDomain) OpenConsole(devname string, stream *libvirt.Stream, flags libvirt.DomainConsoleFlags) error
- func (_m *MockVirDomain) Reboot(flags libvirt.DomainRebootFlagValues) error
- func (_m *MockVirDomain) Resume() error
- func (_m *MockVirDomain) SetTime(secs int64, nsecs uint, flags libvirt.DomainSetTimeFlags) error
- func (_m *MockVirDomain) ShutdownFlags(flags libvirt.DomainShutdownFlags) error
- func (_m *MockVirDomain) Suspend() error
- func (_m *MockVirDomain) UndefineFlags(flags libvirt.DomainUndefineFlagsValues) error
- type Stream
- type VirDomain
- type VirStream
Constants ¶
View Source
const ConnectionInterval = 500 * time.Millisecond
View Source
const ConnectionTimeout = 15 * time.Second
Variables ¶
This section is empty.
Functions ¶
func IsDown ¶
func IsDown(domState libvirt.DomainState) bool
func IsPaused ¶
func IsPaused(domState libvirt.DomainState) bool
Types ¶
type Connection ¶
type Connection interface { LookupDomainByName(name string) (VirDomain, error) DomainDefineXML(xml string) (VirDomain, error) Close() (int, error) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) error DomainEventDeviceAddedRegister(callback libvirt.DomainEventDeviceAddedCallback) error DomainEventDeviceRemovedRegister(callback libvirt.DomainEventDeviceRemovedCallback) error AgentEventLifecycleRegister(callback libvirt.DomainEventAgentLifecycleCallback) error VolatileDomainEventDeviceRemovedRegister(domain VirDomain, callback libvirt.DomainEventDeviceRemovedCallback) (int, error) DomainEventDeregister(registrationID int) error ListAllDomains(flags libvirt.ConnectListAllDomainsFlags) ([]VirDomain, error) NewStream(flags libvirt.StreamFlags) (Stream, error) SetReconnectChan(reconnect chan bool) QemuAgentCommand(command string, domainName string) (string, error) GetAllDomainStats(statsTypes libvirt.DomainStatsTypes, flags libvirt.ConnectGetAllDomainStatsFlags) ([]libvirt.DomainStats, error) // helper method, not found in libvirt // We add this helper to // 1. avoid to expose to the client code the libvirt-specific return type, see docs in stats/ subpackage // 2. transparently handling the addition of the memory stats, currently (libvirt 4.9) not handled by the bulk stats API GetDomainStats(statsTypes libvirt.DomainStatsTypes, l *stats.DomainJobInfo, flags libvirt.ConnectGetAllDomainStatsFlags) ([]*stats.DomainStats, error) }
TODO: Should we handle libvirt connection errors transparent or panic?
func NewConnection ¶
func NewConnectionWithTimeout ¶ added in v0.40.0
type DomainEventDeviceRemoved ¶ added in v0.40.0
type DomainEventDeviceRemoved struct {
// contains filtered or unexported fields
}
func NewDomainEventDeviceRemoved ¶ added in v0.40.0
func NewDomainEventDeviceRemoved( connection Connection, domain VirDomain, callback libvirt.DomainEventDeviceRemovedCallback, eventChan <-chan interface{}) *DomainEventDeviceRemoved
func (*DomainEventDeviceRemoved) Deregister ¶ added in v0.40.0
func (c *DomainEventDeviceRemoved) Deregister() error
func (*DomainEventDeviceRemoved) EventChannel ¶ added in v0.40.0
func (c *DomainEventDeviceRemoved) EventChannel() <-chan interface{}
func (*DomainEventDeviceRemoved) Register ¶ added in v0.40.0
func (c *DomainEventDeviceRemoved) Register() error
type LibvirtConnection ¶
type LibvirtConnection struct { Connect *libvirt.Connect // contains filtered or unexported fields }
func (*LibvirtConnection) AgentEventLifecycleRegister ¶ added in v0.10.0
func (l *LibvirtConnection) AgentEventLifecycleRegister(callback libvirt.DomainEventAgentLifecycleCallback) (err error)
func (*LibvirtConnection) Close ¶
func (l *LibvirtConnection) Close() (int, error)
func (*LibvirtConnection) DomainDefineXML ¶
func (l *LibvirtConnection) DomainDefineXML(xml string) (dom VirDomain, err error)
func (*LibvirtConnection) DomainEventDeregister ¶ added in v0.40.0
func (l *LibvirtConnection) DomainEventDeregister(registrationID int) error
func (*LibvirtConnection) DomainEventDeviceAddedRegister ¶ added in v0.36.0
func (l *LibvirtConnection) DomainEventDeviceAddedRegister(callback libvirt.DomainEventDeviceAddedCallback) (err error)
func (*LibvirtConnection) DomainEventDeviceRemovedRegister ¶ added in v0.36.0
func (l *LibvirtConnection) DomainEventDeviceRemovedRegister(callback libvirt.DomainEventDeviceRemovedCallback) (err error)
func (*LibvirtConnection) DomainEventLifecycleRegister ¶
func (l *LibvirtConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) (err error)
func (*LibvirtConnection) GetAllDomainStats ¶ added in v0.15.0
func (l *LibvirtConnection) GetAllDomainStats(statsTypes libvirt.DomainStatsTypes, flags libvirt.ConnectGetAllDomainStatsFlags) ([]libvirt.DomainStats, error)
func (*LibvirtConnection) GetDeviceAliasMap ¶ added in v0.41.0
func (*LibvirtConnection) GetDomainStats ¶ added in v0.15.0
func (l *LibvirtConnection) GetDomainStats(statsTypes libvirt.DomainStatsTypes, migrateJobInfo *stats.DomainJobInfo, flags libvirt.ConnectGetAllDomainStatsFlags) ([]*stats.DomainStats, error)
func (*LibvirtConnection) ListAllDomains ¶
func (l *LibvirtConnection) ListAllDomains(flags libvirt.ConnectListAllDomainsFlags) ([]VirDomain, error)
func (*LibvirtConnection) LookupDomainByName ¶
func (l *LibvirtConnection) LookupDomainByName(name string) (dom VirDomain, err error)
func (*LibvirtConnection) NewStream ¶
func (l *LibvirtConnection) NewStream(flags libvirt.StreamFlags) (Stream, error)
func (*LibvirtConnection) QemuAgentCommand ¶ added in v0.12.0
func (l *LibvirtConnection) QemuAgentCommand(command string, domainName string) (string, error)
Execute a command on the Qemu guest agent command - the qemu command, for example this gets the interfaces: {"execute":"guest-network-get-interfaces"} domainName - the qemu domain name
func (*LibvirtConnection) SetReconnectChan ¶ added in v0.10.0
func (l *LibvirtConnection) SetReconnectChan(reconnect chan bool)
func (*LibvirtConnection) VolatileDomainEventDeviceRemovedRegister ¶ added in v0.40.0
func (l *LibvirtConnection) VolatileDomainEventDeviceRemovedRegister(domain VirDomain, callback libvirt.DomainEventDeviceRemovedCallback) (int, error)
type MockConnection ¶
type MockConnection struct {
// contains filtered or unexported fields
}
Mock of Connection interface
func NewMockConnection ¶
func NewMockConnection(ctrl *gomock.Controller) *MockConnection
func (*MockConnection) AgentEventLifecycleRegister ¶ added in v0.10.0
func (_m *MockConnection) AgentEventLifecycleRegister(callback libvirt.DomainEventAgentLifecycleCallback) error
func (*MockConnection) Close ¶
func (_m *MockConnection) Close() (int, error)
func (*MockConnection) DomainDefineXML ¶
func (_m *MockConnection) DomainDefineXML(xml string) (VirDomain, error)
func (*MockConnection) DomainEventDeregister ¶ added in v0.40.0
func (_m *MockConnection) DomainEventDeregister(registrationID int) error
func (*MockConnection) DomainEventDeviceAddedRegister ¶ added in v0.36.0
func (_m *MockConnection) DomainEventDeviceAddedRegister(callback libvirt.DomainEventDeviceAddedCallback) error
func (*MockConnection) DomainEventDeviceRemovedRegister ¶ added in v0.36.0
func (_m *MockConnection) DomainEventDeviceRemovedRegister(callback libvirt.DomainEventDeviceRemovedCallback) error
func (*MockConnection) DomainEventLifecycleRegister ¶
func (_m *MockConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) error
func (*MockConnection) EXPECT ¶
func (_m *MockConnection) EXPECT() *_MockConnectionRecorder
func (*MockConnection) GetAllDomainStats ¶ added in v0.15.0
func (_m *MockConnection) GetAllDomainStats(statsTypes libvirt.DomainStatsTypes, flags libvirt.ConnectGetAllDomainStatsFlags) ([]libvirt.DomainStats, error)
func (*MockConnection) GetDomainStats ¶ added in v0.15.0
func (_m *MockConnection) GetDomainStats(statsTypes libvirt.DomainStatsTypes, l *stats.DomainJobInfo, flags libvirt.ConnectGetAllDomainStatsFlags) ([]*stats.DomainStats, error)
func (*MockConnection) ListAllDomains ¶
func (_m *MockConnection) ListAllDomains(flags libvirt.ConnectListAllDomainsFlags) ([]VirDomain, error)
func (*MockConnection) LookupDomainByName ¶
func (_m *MockConnection) LookupDomainByName(name string) (VirDomain, error)
func (*MockConnection) NewStream ¶
func (_m *MockConnection) NewStream(flags libvirt.StreamFlags) (Stream, error)
func (*MockConnection) QemuAgentCommand ¶ added in v0.12.0
func (_m *MockConnection) QemuAgentCommand(command string, domainName string) (string, error)
func (*MockConnection) SetReconnectChan ¶ added in v0.10.0
func (_m *MockConnection) SetReconnectChan(reconnect chan bool)
func (*MockConnection) VolatileDomainEventDeviceRemovedRegister ¶ added in v0.40.0
func (_m *MockConnection) VolatileDomainEventDeviceRemovedRegister(domain VirDomain, callback libvirt.DomainEventDeviceRemovedCallback) (int, error)
type MockStream ¶
type MockStream struct {
// contains filtered or unexported fields
}
Mock of Stream interface
func NewMockStream ¶
func NewMockStream(ctrl *gomock.Controller) *MockStream
func (*MockStream) Close ¶
func (_m *MockStream) Close() error
func (*MockStream) EXPECT ¶
func (_m *MockStream) EXPECT() *_MockStreamRecorder
func (*MockStream) UnderlyingStream ¶
func (_m *MockStream) UnderlyingStream() *libvirt.Stream
type MockVirDomain ¶
type MockVirDomain struct {
// contains filtered or unexported fields
}
Mock of VirDomain interface
func NewMockVirDomain ¶
func NewMockVirDomain(ctrl *gomock.Controller) *MockVirDomain
func (*MockVirDomain) AbortJob ¶ added in v0.15.0
func (_m *MockVirDomain) AbortJob() error
func (*MockVirDomain) AttachDevice ¶ added in v0.36.0
func (_m *MockVirDomain) AttachDevice(xml string) error
func (*MockVirDomain) AttachDeviceFlags ¶ added in v0.40.0
func (_m *MockVirDomain) AttachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error
func (*MockVirDomain) BlockResize ¶ added in v0.48.0
func (_m *MockVirDomain) BlockResize(disk string, size uint64, flags libvirt.DomainBlockResizeFlags) error
func (*MockVirDomain) CoreDumpWithFormat ¶ added in v0.54.0
func (_m *MockVirDomain) CoreDumpWithFormat(to string, format libvirt.DomainCoreDumpFormat, flags libvirt.DomainCoreDumpFlags) error
func (*MockVirDomain) Create ¶
func (_m *MockVirDomain) Create() error
func (*MockVirDomain) CreateWithFlags ¶ added in v0.41.0
func (_m *MockVirDomain) CreateWithFlags(flags libvirt.DomainCreateFlags) error
func (*MockVirDomain) DestroyFlags ¶ added in v0.8.0
func (_m *MockVirDomain) DestroyFlags(flags libvirt.DomainDestroyFlags) error
func (*MockVirDomain) DetachDevice ¶ added in v0.36.0
func (_m *MockVirDomain) DetachDevice(xml string) error
func (*MockVirDomain) DetachDeviceFlags ¶ added in v0.40.0
func (_m *MockVirDomain) DetachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error
func (*MockVirDomain) EXPECT ¶
func (_m *MockVirDomain) EXPECT() *_MockVirDomainRecorder
func (*MockVirDomain) Free ¶
func (_m *MockVirDomain) Free() error
func (*MockVirDomain) GetBlockInfo ¶ added in v0.48.0
func (_m *MockVirDomain) GetBlockInfo(disk string, flags uint32) (*libvirt.DomainBlockInfo, error)
func (*MockVirDomain) GetDiskErrors ¶ added in v0.39.0
func (_m *MockVirDomain) GetDiskErrors(flags uint32) ([]libvirt.DomainDiskError, error)
func (*MockVirDomain) GetJobInfo ¶ added in v0.15.0
func (_m *MockVirDomain) GetJobInfo() (*libvirt.DomainJobInfo, error)
func (*MockVirDomain) GetJobStats ¶ added in v0.15.0
func (_m *MockVirDomain) GetJobStats(flags libvirt.DomainGetJobStatsFlags) (*libvirt.DomainJobInfo, error)
func (*MockVirDomain) GetMetadata ¶ added in v0.10.0
func (_m *MockVirDomain) GetMetadata(tipus libvirt.DomainMetadataType, uri string, flags libvirt.DomainModificationImpact) (string, error)
func (*MockVirDomain) GetName ¶
func (_m *MockVirDomain) GetName() (string, error)
func (*MockVirDomain) GetState ¶
func (_m *MockVirDomain) GetState() (libvirt.DomainState, int, error)
func (*MockVirDomain) GetUUIDString ¶
func (_m *MockVirDomain) GetUUIDString() (string, error)
func (*MockVirDomain) GetXMLDesc ¶
func (_m *MockVirDomain) GetXMLDesc(flags libvirt.DomainXMLFlags) (string, error)
func (*MockVirDomain) IsPersistent ¶ added in v0.36.3
func (_m *MockVirDomain) IsPersistent() (bool, error)
func (*MockVirDomain) MemoryStats ¶ added in v0.15.0
func (_m *MockVirDomain) MemoryStats(nrStats uint32, flags uint32) ([]libvirt.DomainMemoryStat, error)
func (*MockVirDomain) MigrateStartPostCopy ¶ added in v0.34.0
func (_m *MockVirDomain) MigrateStartPostCopy(flags uint32) error
func (*MockVirDomain) MigrateToURI3 ¶ added in v0.15.0
func (_m *MockVirDomain) MigrateToURI3(_param0 string, _param1 *libvirt.DomainMigrateParameters, _param2 libvirt.DomainMigrateFlags) error
func (*MockVirDomain) OpenConsole ¶
func (_m *MockVirDomain) OpenConsole(devname string, stream *libvirt.Stream, flags libvirt.DomainConsoleFlags) error
func (*MockVirDomain) Reboot ¶ added in v0.48.0
func (_m *MockVirDomain) Reboot(flags libvirt.DomainRebootFlagValues) error
func (*MockVirDomain) Resume ¶
func (_m *MockVirDomain) Resume() error
func (*MockVirDomain) SetTime ¶ added in v0.29.0
func (_m *MockVirDomain) SetTime(secs int64, nsecs uint, flags libvirt.DomainSetTimeFlags) error
func (*MockVirDomain) ShutdownFlags ¶ added in v0.8.0
func (_m *MockVirDomain) ShutdownFlags(flags libvirt.DomainShutdownFlags) error
func (*MockVirDomain) Suspend ¶ added in v0.24.0
func (_m *MockVirDomain) Suspend() error
func (*MockVirDomain) UndefineFlags ¶ added in v0.17.0
func (_m *MockVirDomain) UndefineFlags(flags libvirt.DomainUndefineFlagsValues) error
type VirDomain ¶
type VirDomain interface { GetState() (libvirt.DomainState, int, error) Create() error CreateWithFlags(flags libvirt.DomainCreateFlags) error Suspend() error Resume() error BlockResize(disk string, size uint64, flags libvirt.DomainBlockResizeFlags) error GetBlockInfo(disk string, flags uint32) (*libvirt.DomainBlockInfo, error) AttachDevice(xml string) error AttachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error DetachDevice(xml string) error DetachDeviceFlags(xml string, flags libvirt.DomainDeviceModifyFlags) error DestroyFlags(flags libvirt.DomainDestroyFlags) error ShutdownFlags(flags libvirt.DomainShutdownFlags) error Reboot(flags libvirt.DomainRebootFlagValues) error UndefineFlags(flags libvirt.DomainUndefineFlagsValues) error GetName() (string, error) GetUUIDString() (string, error) GetXMLDesc(flags libvirt.DomainXMLFlags) (string, error) GetMetadata(tipus libvirt.DomainMetadataType, uri string, flags libvirt.DomainModificationImpact) (string, error) OpenConsole(devname string, stream *libvirt.Stream, flags libvirt.DomainConsoleFlags) error MigrateToURI3(string, *libvirt.DomainMigrateParameters, libvirt.DomainMigrateFlags) error MigrateStartPostCopy(flags uint32) error MemoryStats(nrStats uint32, flags uint32) ([]libvirt.DomainMemoryStat, error) GetJobStats(flags libvirt.DomainGetJobStatsFlags) (*libvirt.DomainJobInfo, error) GetJobInfo() (*libvirt.DomainJobInfo, error) GetDiskErrors(flags uint32) ([]libvirt.DomainDiskError, error) SetTime(secs int64, nsecs uint, flags libvirt.DomainSetTimeFlags) error IsPersistent() (bool, error) AbortJob() error Free() error CoreDumpWithFormat(to string, format libvirt.DomainCoreDumpFormat, flags libvirt.DomainCoreDumpFlags) error }
Click to show internal directories.
Click to hide internal directories.