utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLibVirtConIsNil = errors.New("the libvirt connection was nil")

ErrLibVirtConIsNil is returned when the libvirt connection is nil.

View Source
var WaitSleepInterval = 1 * time.Second

WaitSleepInterval time

View Source
var WaitTimeout = 5 * time.Minute

WaitTimeout time

Functions

func CreateDomain

func CreateDomain(name, ignKey, volumeName, hostName, networkInterfaceName, networkInterfaceAddress string, autostart bool, memory, vcpu, offset int, client *Client, cloudInit *providerconfigv1.CloudInit, kubeClient kubernetes.Interface, machineNamespace string) error

func CreateIgntion

func CreateIgntion(pool, name, content string, client *Client) error

func CreateNetwork

func CreateNetwork(name, domain, bridge, mode string, addresses []string, autostart bool, client *Client) error

func CreateVolume

func CreateVolume(volumeName, poolName, baseVolumeID, source, volumeFormat string, client *Client) error

func DeleteDomain

func DeleteDomain(name string, client *Client) error

func DeleteNetwork

func DeleteNetwork(name string, client *Client) error

func DeleteVolume

func DeleteVolume(name string, client *Client) error

DeleteVolume removes the volume identified by `key` from libvirt

func DomainExists

func DomainExists(name string, client *Client) (bool, error)

DomainExists verify a domain exists for given machine

func DomainStateString

func DomainStateString(state libvirt.DomainState) string

DomainStateString returns a human-readable string for the given libvirt domain state.

func HasDHCP

func HasDHCP(net libvirtxml.Network) bool

HasDHCP checks if the network has a DHCP server managed by libvirt

func LookupDomainByName

func LookupDomainByName(name string, client *Client) (*libvirt.Domain, error)

LookupDomainByName looks up a domain by name and returns a pointer to it. Note: The caller is responsible for freeing the returned domain.

func NodeAddresses

func NodeAddresses(dom *libvirt.Domain) ([]corev1.NodeAddress, error)

NodeAddresses returns a slice of corev1.NodeAddress objects for a given libvirt domain.

Types

type Client

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

Client libvirt

func BuildClient

func BuildClient(URI string) (*Client, error)

Client libvirt, generate libvirt client given URI

func (*Client) Close

func (c *Client) Close() error

Close closes the client's libvirt connection.

type Config

type Config struct {
	URI string
}

Config struct for the libvirt-provider

type Network

type Network interface {
	GetXMLDesc(flags libvirt.NetworkXMLFlags) (string, error)
}

Network interface used to expose a libvirt.Network

type StreamIO

type StreamIO struct {
	Stream libvirt.Stream
}

StreamIO libvirt struct

func NewStreamIO

func NewStreamIO(s libvirt.Stream) *StreamIO

NewStreamIO returns libvirt StreamIO

func (*StreamIO) Close

func (sio *StreamIO) Close() error

Close closes the stream

func (*StreamIO) Read

func (sio *StreamIO) Read(p []byte) (int, error)

func (*StreamIO) Write

func (sio *StreamIO) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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