Documentation
¶
Index ¶
- Constants
- func ByteCountIEC(b uint64) string
- func GetOpenstackUUID(domain libvirt.Domain) string
- type Interface
- type InterfaceMock
- func (mock *InterfaceMock) Close() error
- func (mock *InterfaceMock) CloseCalls() []struct{}
- func (mock *InterfaceMock) Connect() error
- func (mock *InterfaceMock) ConnectCalls() []struct{}
- func (mock *InterfaceMock) GetCapabilities() (v1.CapabilitiesStatus, error)
- func (mock *InterfaceMock) GetCapabilitiesCalls() []struct{}
- func (mock *InterfaceMock) GetDomainsActive() ([]libvirt.Domain, error)
- func (mock *InterfaceMock) GetDomainsActiveCalls() []struct{}
- func (mock *InterfaceMock) GetInstances() ([]v1.Instance, error)
- func (mock *InterfaceMock) GetInstancesCalls() []struct{}
- func (mock *InterfaceMock) GetNumInstances() int
- func (mock *InterfaceMock) GetNumInstancesCalls() []struct{}
- func (mock *InterfaceMock) GetVersion() string
- func (mock *InterfaceMock) GetVersionCalls() []struct{}
- func (mock *InterfaceMock) IsConnected() bool
- func (mock *InterfaceMock) IsConnectedCalls() []struct{}
- type LibVirt
- func (l *LibVirt) Close() error
- func (l *LibVirt) Connect() error
- func (l *LibVirt) GetCapabilities() (v1.CapabilitiesStatus, error)
- func (l *LibVirt) GetDomainsActive() ([]libvirt.Domain, error)
- func (l *LibVirt) GetInstances() ([]v1.Instance, error)
- func (l *LibVirt) GetNumInstances() int
- func (l *LibVirt) GetVersion() string
- func (l *LibVirt) IsConnected() bool
- type UUID
Constants ¶
const ( VIR_DOMAIN_JOB_NONE = iota /* No job is active (Since: 0.7.7) */ VIR_DOMAIN_JOB_BOUNDED /* Job with a finite completion time (Since: 0.7.7) */ VIR_DOMAIN_JOB_UNBOUNDED /* Job without a finite completion time (Since: 0.7.7) */ VIR_DOMAIN_JOB_COMPLETED /* Job has finished, but isn't cleaned up (Since: 0.7.7) */ VIR_DOMAIN_JOB_FAILED /* Job hit error, but isn't cleaned up (Since: 0.7.7) */ VIR_DOMAIN_JOB_CANCELLED /* Job was aborted, but isn't cleaned up (Since: 0.7.7) */ )
const ( VIR_DOMAIN_JOB_OPERATION_UNKNOWN = iota /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_START /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_SAVE /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_RESTORE /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_SNAPSHOT /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_DUMP /* (Since: 3.3.0) */ VIR_DOMAIN_JOB_OPERATION_BACKUP /* (Since: 6.0.0) */ VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_DELETE /* (Since: 9.0.0) */ )
Variables ¶
This section is empty.
Functions ¶
func ByteCountIEC ¶
func GetOpenstackUUID ¶
func GetOpenstackUUID(domain libvirt.Domain) string
Types ¶
type Interface ¶
type Interface interface { // Connect connects to the libvirt daemon. Connect() error // Close closes the connection to the libvirt daemon. Close() error // GetInstances returns a list of instances. GetInstances() ([]v1.Instance, error) // GetDomainsActive returns all active domains. GetDomainsActive() ([]libvirt.Domain, error) // IsConnected returns true if the connection to the libvirt daemon is open. IsConnected() bool // GetVersion returns the version of the libvirt daemon. GetVersion() string // GetNumInstances returns the number of instances. GetNumInstances() int // Get the capabilities of the libvirt daemon. GetCapabilities() (v1.CapabilitiesStatus, error) }
type InterfaceMock ¶
type InterfaceMock struct { // CloseFunc mocks the Close method. CloseFunc func() error // ConnectFunc mocks the Connect method. ConnectFunc func() error // GetCapabilitiesFunc mocks the GetCapabilities method. GetCapabilitiesFunc func() (v1.CapabilitiesStatus, error) // GetDomainsActiveFunc mocks the GetDomainsActive method. GetDomainsActiveFunc func() ([]libvirt.Domain, error) // GetInstancesFunc mocks the GetInstances method. GetInstancesFunc func() ([]v1.Instance, error) // GetNumInstancesFunc mocks the GetNumInstances method. GetNumInstancesFunc func() int // GetVersionFunc mocks the GetVersion method. GetVersionFunc func() string // IsConnectedFunc mocks the IsConnected method. IsConnectedFunc func() bool // contains filtered or unexported fields }
InterfaceMock is a mock implementation of Interface.
func TestSomethingThatUsesInterface(t *testing.T) { // make and configure a mocked Interface mockedInterface := &InterfaceMock{ CloseFunc: func() error { panic("mock out the Close method") }, ConnectFunc: func() error { panic("mock out the Connect method") }, GetCapabilitiesFunc: func() (v1.CapabilitiesStatus, error) { panic("mock out the GetCapabilities method") }, GetDomainsActiveFunc: func() ([]libvirt.Domain, error) { panic("mock out the GetDomainsActive method") }, GetInstancesFunc: func() ([]v1.Instance, error) { panic("mock out the GetInstances method") }, GetNumInstancesFunc: func() int { panic("mock out the GetNumInstances method") }, GetVersionFunc: func() string { panic("mock out the GetVersion method") }, IsConnectedFunc: func() bool { panic("mock out the IsConnected method") }, } // use mockedInterface in code that requires Interface // and then make assertions. }
func (*InterfaceMock) CloseCalls ¶
func (mock *InterfaceMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedInterface.CloseCalls())
func (*InterfaceMock) Connect ¶
func (mock *InterfaceMock) Connect() error
Connect calls ConnectFunc.
func (*InterfaceMock) ConnectCalls ¶
func (mock *InterfaceMock) ConnectCalls() []struct { }
ConnectCalls gets all the calls that were made to Connect. Check the length with:
len(mockedInterface.ConnectCalls())
func (*InterfaceMock) GetCapabilities ¶
func (mock *InterfaceMock) GetCapabilities() (v1.CapabilitiesStatus, error)
GetCapabilities calls GetCapabilitiesFunc.
func (*InterfaceMock) GetCapabilitiesCalls ¶
func (mock *InterfaceMock) GetCapabilitiesCalls() []struct { }
GetCapabilitiesCalls gets all the calls that were made to GetCapabilities. Check the length with:
len(mockedInterface.GetCapabilitiesCalls())
func (*InterfaceMock) GetDomainsActive ¶
func (mock *InterfaceMock) GetDomainsActive() ([]libvirt.Domain, error)
GetDomainsActive calls GetDomainsActiveFunc.
func (*InterfaceMock) GetDomainsActiveCalls ¶
func (mock *InterfaceMock) GetDomainsActiveCalls() []struct { }
GetDomainsActiveCalls gets all the calls that were made to GetDomainsActive. Check the length with:
len(mockedInterface.GetDomainsActiveCalls())
func (*InterfaceMock) GetInstances ¶
func (mock *InterfaceMock) GetInstances() ([]v1.Instance, error)
GetInstances calls GetInstancesFunc.
func (*InterfaceMock) GetInstancesCalls ¶
func (mock *InterfaceMock) GetInstancesCalls() []struct { }
GetInstancesCalls gets all the calls that were made to GetInstances. Check the length with:
len(mockedInterface.GetInstancesCalls())
func (*InterfaceMock) GetNumInstances ¶
func (mock *InterfaceMock) GetNumInstances() int
GetNumInstances calls GetNumInstancesFunc.
func (*InterfaceMock) GetNumInstancesCalls ¶
func (mock *InterfaceMock) GetNumInstancesCalls() []struct { }
GetNumInstancesCalls gets all the calls that were made to GetNumInstances. Check the length with:
len(mockedInterface.GetNumInstancesCalls())
func (*InterfaceMock) GetVersion ¶
func (mock *InterfaceMock) GetVersion() string
GetVersion calls GetVersionFunc.
func (*InterfaceMock) GetVersionCalls ¶
func (mock *InterfaceMock) GetVersionCalls() []struct { }
GetVersionCalls gets all the calls that were made to GetVersion. Check the length with:
len(mockedInterface.GetVersionCalls())
func (*InterfaceMock) IsConnected ¶
func (mock *InterfaceMock) IsConnected() bool
IsConnected calls IsConnectedFunc.
func (*InterfaceMock) IsConnectedCalls ¶
func (mock *InterfaceMock) IsConnectedCalls() []struct { }
IsConnectedCalls gets all the calls that were made to IsConnected. Check the length with:
len(mockedInterface.IsConnectedCalls())
type LibVirt ¶
type LibVirt struct {
// contains filtered or unexported fields
}
func NewLibVirt ¶
func (*LibVirt) GetCapabilities ¶
func (l *LibVirt) GetCapabilities() (v1.CapabilitiesStatus, error)
Get the capabilities of the libvirt daemon.