client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDomainNotFound = errors.New("Domain not found")

ErrDomainNotFound is returned when a domain is not found

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

ErrLibVirtConIsNil is returned when the libvirt connection is nil.

View Source
var ErrVolumeNotFound = errors.New("Domain not found")

ErrVolumeNotFound is returned when a domain is not found

Functions

func HasDHCP

func HasDHCP(net libvirtxml.Network) bool

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

Types

type Client

type Client interface {
	// Close closes the client's libvirt connection.
	Close() error

	// CreateDomain creates domain based on CreateDomainInput
	CreateDomain(CreateDomainInput) error

	// DeleteDomain deletes a domain
	DeleteDomain(name string) error

	// DomainExists checks if domain exists
	DomainExists(name string) (bool, error)

	// LookupDomainByName looks up a domain based on its name
	LookupDomainByName(name string) (*libvirt.Domain, error)

	// CreateVolume creates volume based on CreateVolumeInput
	CreateVolume(CreateVolumeInput) error

	// VolumeExists checks if volume exists
	VolumeExists(name string) (bool, error)

	// DeleteVolume deletes a domain based on its name
	DeleteVolume(name string) error
}

Client is a wrapper object for actual libvirt library to allow for easier testing.

func NewClient

func NewClient(URI string) (Client, error)

Client libvirt, generate libvirt client given URI

type Config

type Config struct {
	URI string
}

Config struct for the libvirt-provider

type CreateDomainInput

type CreateDomainInput struct {
	// DomainName is name of domain to be created
	DomainName string

	// IgnKey is name of existing volume with ignition config (DEPRECATED)
	IgnKey string

	// Ignition configuration to be injected during bootstrapping
	Ignition *providerconfigv1.Ignition

	// CloudInit configuration to be run during bootstrapping
	CloudInit *providerconfigv1.CloudInit

	// VolumeName of volume to be added to domain definition
	VolumeName string

	// CloudInitVolumeName of cloud init volume to be added to domain definition
	CloudInitVolumeName string

	// IgnitionVolumeName of ignition volume to be added to domain definition
	IgnitionVolumeName string

	// VolumePoolName of pool where VolumeName volume is located
	VolumePoolName string

	// NetworkInterfaceName as name of network interface
	NetworkInterfaceName string

	// NetworkInterfaceAddress as address of network interface
	NetworkInterfaceAddress string

	// HostName as network interface hostname
	HostName string

	// AddressRange as IP subnet address range
	AddressRange int

	// Autostart as domain autostart
	Autostart bool

	// DomainMemory allocated for running domain
	DomainMemory int

	// DomainVcpu allocated for running domain
	DomainVcpu int

	// KubeClient as kubernetes client
	KubeClient kubernetes.Interface

	// MachineNamespace with machine object
	MachineNamespace string
}

CreateDomainInput specifies input parameters for CreateDomain operation

type CreateVolumeInput

type CreateVolumeInput struct {
	// VolumeName to be created
	VolumeName string

	// PoolName where VolumeName volume is located
	PoolName string

	// BaseVolumeID as base volume ID
	BaseVolumeID string

	// Source as location of base volume
	Source string

	// VolumeFormat as volume format
	VolumeFormat string
}

CreateVolumeInput specifies input parameters for CreateVolume operation

type LibvirtClientBuilderFuncType

type LibvirtClientBuilderFuncType func(URI string) (Client, error)

LibvirtClientBuilderFuncType is function type for building aws client

type Network

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

Network interface used to expose a libvirt.Network

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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