cli

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectionInterval = 10 * time.Second
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
	AgentEventLifecycleRegister(callback libvirt.DomainEventAgentLifecycleCallback) error
	ListAllDomains(flags libvirt.ConnectListAllDomainsFlags) ([]VirDomain, error)
	NewStream(flags libvirt.StreamFlags) (Stream, error)
	SetReconnectChan(reconnect chan bool)
}

TODO: Should we handle libvirt connection errors transparent or panic?

func NewConnection

func NewConnection(uri string, user string, pass string, checkInterval time.Duration) (Connection, 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) DomainEventLifecycleRegister

func (l *LibvirtConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) (err 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) SetReconnectChan added in v0.10.0

func (l *LibvirtConnection) SetReconnectChan(reconnect chan bool)

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_go.DomainEventAgentLifecycleCallback) error

func (*MockConnection) Close

func (_m *MockConnection) Close() (int, error)

func (*MockConnection) DomainDefineXML

func (_m *MockConnection) DomainDefineXML(xml string) (VirDomain, error)

func (*MockConnection) DomainEventLifecycleRegister

func (_m *MockConnection) DomainEventLifecycleRegister(callback libvirt_go.DomainEventLifecycleCallback) error

func (*MockConnection) EXPECT

func (_m *MockConnection) EXPECT() *_MockConnectionRecorder

func (*MockConnection) ListAllDomains

func (_m *MockConnection) ListAllDomains(flags libvirt_go.ConnectListAllDomainsFlags) ([]VirDomain, error)

func (*MockConnection) LookupDomainByName

func (_m *MockConnection) LookupDomainByName(name string) (VirDomain, error)

func (*MockConnection) NewStream

func (_m *MockConnection) NewStream(flags libvirt_go.StreamFlags) (Stream, error)

func (*MockConnection) SetReconnectChan added in v0.10.0

func (_m *MockConnection) SetReconnectChan(reconnect chan bool)

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

func (_m *MockStream) Read(p []byte) (int, error)

func (*MockStream) UnderlyingStream

func (_m *MockStream) UnderlyingStream() *libvirt_go.Stream

func (*MockStream) Write

func (_m *MockStream) Write(p []byte) (int, error)

type MockVirDomain

type MockVirDomain struct {
	// contains filtered or unexported fields
}

Mock of VirDomain interface

func NewMockVirDomain

func NewMockVirDomain(ctrl *gomock.Controller) *MockVirDomain

func (*MockVirDomain) Create

func (_m *MockVirDomain) Create() error

func (*MockVirDomain) DestroyFlags added in v0.8.0

func (_m *MockVirDomain) DestroyFlags(flags libvirt_go.DomainDestroyFlags) error

func (*MockVirDomain) EXPECT

func (_m *MockVirDomain) EXPECT() *_MockVirDomainRecorder

func (*MockVirDomain) Free

func (_m *MockVirDomain) Free() error

func (*MockVirDomain) GetMetadata added in v0.10.0

func (*MockVirDomain) GetName

func (_m *MockVirDomain) GetName() (string, error)

func (*MockVirDomain) GetState

func (_m *MockVirDomain) GetState() (libvirt_go.DomainState, int, error)

func (*MockVirDomain) GetUUIDString

func (_m *MockVirDomain) GetUUIDString() (string, error)

func (*MockVirDomain) GetXMLDesc

func (_m *MockVirDomain) GetXMLDesc(flags libvirt_go.DomainXMLFlags) (string, error)

func (*MockVirDomain) Migrate added in v0.9.2

func (_m *MockVirDomain) Migrate(_param0 *libvirt_go.Connect, _param1 libvirt_go.DomainMigrateFlags, _param2 string, _param3 string, _param4 uint64) (*libvirt_go.Domain, error)

func (*MockVirDomain) OpenConsole

func (_m *MockVirDomain) OpenConsole(devname string, stream *libvirt_go.Stream, flags libvirt_go.DomainConsoleFlags) error

func (*MockVirDomain) Resume

func (_m *MockVirDomain) Resume() error

func (*MockVirDomain) ShutdownFlags added in v0.8.0

func (_m *MockVirDomain) ShutdownFlags(flags libvirt_go.DomainShutdownFlags) error

func (*MockVirDomain) Undefine

func (_m *MockVirDomain) Undefine() error

type Stream

type Stream interface {
	io.ReadWriteCloser
	UnderlyingStream() *libvirt.Stream
}

type VirDomain

type VirDomain interface {
	GetState() (libvirt.DomainState, int, error)
	Create() error
	Resume() error
	DestroyFlags(flags libvirt.DomainDestroyFlags) error
	ShutdownFlags(flags libvirt.DomainShutdownFlags) error
	Undefine() 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
	Migrate(*libvirt.Connect, libvirt.DomainMigrateFlags, string, string, uint64) (*libvirt.Domain, error)
	Free() error
}

type VirStream

type VirStream struct {
	*libvirt.Stream
}

func (*VirStream) Close

func (s *VirStream) Close() (e error)

Close the stream and free its resources. Since closing a stream involves multiple calls with errors, the first error occurred will be returned. The stream will always be freed.

func (*VirStream) Read

func (s *VirStream) Read(p []byte) (n int, err error)

func (*VirStream) UnderlyingStream

func (s *VirStream) UnderlyingStream() *libvirt.Stream

func (*VirStream) Write

func (s *VirStream) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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