lxdutil

package
v0.0.0-...-b99738b Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProject = "default"
View Source
const Running = "Running"

Variables

This section is empty.

Functions

func AnnotateLXDError

func AnnotateLXDError(name string, err error) error

func ConfigDir

func ConfigDir() (string, error)

func FileExists

func FileExists(server lxd.InstanceServer, container string, file string) bool

func MinNumber

func MinNumber(numbers []*util.NamedNumber) int

func QualifiedContainerName

func QualifiedContainerName(project string, container string) string

func SplitSnapshotName

func SplitSnapshotName(name string) (container, snapshot string)

func WaitForNetwork

func WaitForNetwork(server lxd.InstanceServer, instance string) error

Types

type AddressPrinter

type AddressPrinter interface {
	Print(addresses []*HostAddress, writer io.Writer) error
}

type AssignNumbers

type AssignNumbers struct {
	Client  *LxdClient
	File    string `name:"f" usage:"numbers CSV file (container,number)"`
	First   int    `name:"first" usage:"first number"`
	Last    int    `name:"last" usage:"last number (optional)"`
	Project string `name:"project" usage:"add containers from LXD project"`
	Running bool   `name:"r" usage:"use only running containers from specified project"`
	Clean   bool   `name:"clean" usage:"remove numbers for containers that are not selected"`
}

Assign persistent number to containers. Used to assign a unique ssh port to each container

func (*AssignNumbers) AddNumbers

func (t *AssignNumbers) AddNumbers(numbers []*util.NamedNumber, names []string) ([]*util.NamedNumber, error)

func (*AssignNumbers) Configured

func (t *AssignNumbers) Configured() error

func (*AssignNumbers) Run

func (t *AssignNumbers) Run(containers []string) error

type CsvAddressPrinter

type CsvAddressPrinter struct {
	Headers bool
}

func (*CsvAddressPrinter) Print

func (t *CsvAddressPrinter) Print(addresses []*HostAddress, writer io.Writer) error

type Functions

type Functions struct {
}

func (*Functions) Json

func (t *Functions) Json(v any) (string, error)

func (*Functions) Uint16

func (h *Functions) Uint16(s string) (uint16, error)

func (*Functions) Uint8

func (h *Functions) Uint8(s string) (uint8, error)

type HostAddress

type HostAddress struct {
	Name    string
	Address string
}

type HostFunctions

type HostFunctions struct {
}

func (*HostFunctions) Ipv4

func (h *HostFunctions) Ipv4() (string, error)

func (*HostFunctions) Ipv6

func (h *HostFunctions) Ipv6() (string, error)

func (*HostFunctions) PrivateIpv4

func (h *HostFunctions) PrivateIpv4() (network.Ipv4, error)

func (*HostFunctions) PrivateIpv6

func (h *HostFunctions) PrivateIpv6() (network.Ipv6, error)

type ImageOps

type ImageOps struct {
	Client *LxdClient `name:"-"`
}

func (*ImageOps) Containers

func (t *ImageOps) Containers(name string) error

func (*ImageOps) List

func (t *ImageOps) List() error

func (*ImageOps) ListFingerprints

func (t *ImageOps) ListFingerprints() error

type InstanceDevicesOp

type InstanceDevicesOp struct {
	InstanceOps *InstanceOps `name:""`
	Yaml        bool
}

func (*InstanceDevicesOp) Devices

func (t *InstanceDevicesOp) Devices(instance string) error

type InstanceOps

type InstanceOps struct {
	Client *LxdClient `name:"-"`
	// contains filtered or unexported fields
}

InstanceOps - operations on LXD instances (formerly ContainerOps)

func (*InstanceOps) Config

func (t *InstanceOps) Config(instance string) error

func (*InstanceOps) Configured

func (t *InstanceOps) Configured() error

func (*InstanceOps) Info

func (t *InstanceOps) Info(instance string) error

func (*InstanceOps) ListHwaddr

func (t *InstanceOps) ListHwaddr() error

func (*InstanceOps) ListImages

func (t *InstanceOps) ListImages() error

func (*InstanceOps) Network

func (t *InstanceOps) Network(instance string) error

func (*InstanceOps) Profiles

func (t *InstanceOps) Profiles(instance string) error

func (*InstanceOps) State

func (t *InstanceOps) State(instance string) error

func (*InstanceOps) Statistics

func (t *InstanceOps) Statistics() error

func (*InstanceOps) Wait

func (t *InstanceOps) Wait(args []string) error

type InstanceServer

type InstanceServer struct {
	Server lxd.InstanceServer
}

func (InstanceServer) ProfileExists

func (t InstanceServer) ProfileExists(profile string) bool

func (InstanceServer) StartContainer

func (t InstanceServer) StartContainer(container string) error

func (InstanceServer) StopContainer

func (t InstanceServer) StopContainer(container string) error

type LxcConfig

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

func (*LxcConfig) CurrentProject

func (t *LxcConfig) CurrentProject() string

type LxdClient

type LxdClient struct {
	Socket string
	Http   bool `usage:"connect to LXD using http"`
	Unix   bool `usage:"connect to LXD using unix socket"`

	LxcConfig
	// contains filtered or unexported fields
}

func (*LxdClient) CurrentServer

func (t *LxdClient) CurrentServer() (lxd.InstanceServer, error)

func (*LxdClient) Init

func (t *LxdClient) Init() error

func (*LxdClient) ProjectServer

func (t *LxdClient) ProjectServer(project string) (lxd.InstanceServer, error)

func (*LxdClient) RootServer

func (t *LxdClient) RootServer() (lxd.InstanceServer, error)

type NetworkManager

type NetworkManager struct {
	Client *LxdClient
}

func (*NetworkManager) GetAddresses

func (t *NetworkManager) GetAddresses(family string) ([]*HostAddress, error)

func (*NetworkManager) GetProjectAddresses

func (t *NetworkManager) GetProjectAddresses(server lxd.InstanceServer, instanceType api.InstanceType, project string, family string) ([]*HostAddress, error)

func (*NetworkManager) ParseAddress

func (t *NetworkManager) ParseAddress(addr string) string

func (*NetworkManager) WriteAddresses

func (t *NetworkManager) WriteAddresses(addresses []*HostAddress, file string, headers bool) error

type NetworkOp

type NetworkOp struct {
	Client     *LxdClient `name:"-"`
	OutputFile string     `name:"o" usage:"output file"`
	Format     string     `name:"format" usage:"include format: csv | yaml"`
	Headers    bool       `name:"headers" usage:"include headers"`
	Family     string     `name:"family" usage:"network family: inet | inet6"`
}

func (*NetworkOp) ExportAddresses

func (t *NetworkOp) ExportAddresses() error

func (*NetworkOp) Init

func (t *NetworkOp) Init() error

type ProfileOps

type ProfileOps struct {
	Client *LxdClient `name:"-"`
	Dir    string     `name:"d" usage:"export directory"`
}

func (*ProfileOps) Export

func (t *ProfileOps) Export(profiles ...string) error

func (*ProfileOps) ExportProfile

func (t *ProfileOps) ExportProfile(server lxd.InstanceServer, name string) error

func (*ProfileOps) Import

func (t *ProfileOps) Import(files []string) error

func (*ProfileOps) ImportProfile

func (t *ProfileOps) ImportProfile(server lxd.InstanceServer, file string, existingProfiles map[string]bool) error

type ProjectCopyProfiles

type ProjectCopyProfiles struct {
	Client        *LxdClient `name:"-"`
	SourceProject string     `name:"source-project" usage:"project to copy profiles from"`
	TargetProject string     `name:"target-project" usage:"project to copy profiles to"`
}

func (*ProjectCopyProfiles) CopyProfiles

func (t *ProjectCopyProfiles) CopyProfiles(profiles []string) error

type ProjectCreate

type ProjectCreate struct {
	Client *LxdClient `name:"-"`
}

func (*ProjectCreate) Create

func (t *ProjectCreate) Create(projects ...string) error

type Statistics

type Statistics struct {
	Containers int
	Devices    int
}

type TemplateOps

type TemplateOps struct {
	Client *LxdClient `name:"-"`
	templatecmd.TemplateOp
}

func (*TemplateOps) Apply

func (t *TemplateOps) Apply() error

type YamlAddressPrinter

type YamlAddressPrinter struct {
}

func (*YamlAddressPrinter) Print

func (t *YamlAddressPrinter) Print(addresses []*HostAddress, writer io.Writer) error

Jump to

Keyboard shortcuts

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