agent

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDomainXML added in v0.5.0

func GenerateDomainXML(vmName, isoPath, diskPath string) ([]byte, error)

func NewPlannerAgent

func NewPlannerAgent(name, url string) (*plannerAgentLibvirt, error)

NewPlannerAgent creates a new libvirt-based planner agent instance

func WaitForDomainState

func WaitForDomainState(duration time.Duration, domain *libvirt.Domain, desiredState libvirt.DomainState) error

WaitForDomainState polls the libvirt domain state until the desired state is reached or a timeout occurs. It checks the state once every second.

Types

type AgentApi

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

AgentApi provides a client to interact with the Planner Agent API

func DefaultAgentApi

func DefaultAgentApi(agentApiBaseUrl string) *AgentApi

DefaultAgentApi creates an AgentApi client with a default HTTP client that skips TLS verification

func NewAgentApi

func NewAgentApi(agentApiBaseUrl string, customHttpClient *http.Client) *AgentApi

NewAgentApi creates an AgentApi client with a custom HTTP client, useful for test customization

func (*AgentApi) GetCollectorStatus added in v0.5.0

func (a *AgentApi) GetCollectorStatus() (*CollectorStatus, error)

func (*AgentApi) Inventory

func (a *AgentApi) Inventory() (*v1alpha1.Inventory, error)

Inventory retrieves the inventory data collected by the agent. The agent returns a v2 envelope wrapping UpdateInventory; we unwrap it here.

func (*AgentApi) PutCredentials added in v0.21.0

func (a *AgentApi) PutCredentials(vcenterURL, username, password string) (int, error)

func (*AgentApi) SetAgentMode added in v0.5.0

func (a *AgentApi) SetAgentMode(mode string) (*AgentStatus, error)

func (*AgentApi) StartCollector added in v0.5.0

func (a *AgentApi) StartCollector() (*CollectorStatus, int, error)

func (*AgentApi) Status

func (a *AgentApi) Status() (*AgentStatus, error)

Status retrieves the current status of the agent

type AgentApiCollectorStatus added in v0.5.0

type AgentApiCollectorStatus string
var (
	CollectorStatusCollected AgentApiCollectorStatus = "collected"
	CollectorStatusError     AgentApiCollectorStatus = "error"
)

type AgentMode added in v0.5.0

type AgentMode string
var (
	AgentModeConnected AgentMode = "connected"
)

type AgentModeRequest added in v0.5.0

type AgentModeRequest struct {
	Mode string `json:"mode"`
}

type AgentStatus added in v0.5.0

type AgentStatus struct {
	Mode              string                  `json:"mode"`
	ConsoleConnection ConsoleConnectionStatus `json:"consoleConnection"`
}

type Boot added in v0.5.0

type Boot struct {
	Dev string `xml:"dev,attr"`
}

type CPU added in v0.5.0

type CPU struct {
	Mode       string `xml:"mode,attr"`
	Check      string `xml:"check,attr"`
	Migratable string `xml:"migratable,attr"`
}

type CollectorStatus added in v0.5.0

type CollectorStatus struct {
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

type Console added in v0.5.0

type Console struct {
	Type string `xml:"type,attr"`
}

type ConsoleConnectionStatus added in v0.21.0

type ConsoleConnectionStatus struct {
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

type CredentialsRequest added in v0.21.0

type CredentialsRequest struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Devices added in v0.5.0

type Devices struct {
	Emulator  string    `xml:"emulator"`
	Disks     []Disk    `xml:"disk"`
	Interface Interface `xml:"interface"`
	Graphics  Graphics  `xml:"graphics"`
	Console   Console   `xml:"console"`
}

type Disk added in v0.5.0

type Disk struct {
	Type     string    `xml:"type,attr"`
	Device   string    `xml:"device,attr"`
	Driver   Driver    `xml:"driver"`
	Source   Source    `xml:"source"`
	Target   Target    `xml:"target"`
	Readonly *struct{} `xml:"readonly,omitempty"`
}

type Domain added in v0.5.0

type Domain struct {
	XMLName xml.Name `xml:"domain"`
	Type    string   `xml:"type,attr"`

	Name     string   `xml:"name"`
	Memory   Memory   `xml:"memory"`
	VCPU     VCPU     `xml:"vcpu"`
	Metadata Metadata `xml:"metadata"`
	OS       OS       `xml:"os"`
	CPU      CPU      `xml:"cpu"`
	Features Features `xml:"features"`
	Devices  Devices  `xml:"devices"`
}

type Driver added in v0.5.0

type Driver struct {
	Name string `xml:"name,attr"`
	Type string `xml:"type,attr"`
}

type Features added in v0.5.0

type Features struct {
	ACPI struct{} `xml:"acpi"`
	APIC struct{} `xml:"apic"`
}

type Graphics added in v0.5.0

type Graphics struct {
	Type string `xml:"type,attr"`
	Port string `xml:"port,attr"`
}

type Interface added in v0.5.0

type Interface struct {
	Type   string    `xml:"type,attr"`
	Source NetSource `xml:"source"`
	Model  Model     `xml:"model"`
}

type LibOS added in v0.5.0

type LibOS struct {
	ID string `xml:"id,attr"`
}

type LibOSInfo added in v0.5.0

type LibOSInfo struct {
	XMLName xml.Name `xml:"libosinfo:libosinfo"`
	Xmlns   string   `xml:"xmlns:libosinfo,attr"`
	OS      LibOS    `xml:"libosinfo:os"`
}

type Memory added in v0.5.0

type Memory struct {
	Unit  string `xml:"unit,attr"`
	Value int    `xml:",chardata"`
}

type Metadata added in v0.5.0

type Metadata struct {
	LibOSInfo LibOSInfo `xml:"libosinfo:libosinfo"`
}

type Model added in v0.5.0

type Model struct {
	Type string `xml:"type,attr"`
}

type NetSource added in v0.5.0

type NetSource struct {
	Network string `xml:"network,attr"`
}

type OS added in v0.5.0

type OS struct {
	Type Type `xml:"type"`
	Boot Boot `xml:"boot"`
}

type PlannerAgent

type PlannerAgent interface {
	DumpLogs(string)
	DumpDataDir() error
	GetIp() (string, error)
	Run() error
	Restart() error
	Remove() error
}

PlannerAgent defines the interface for interacting with a planner agent instance

type Source added in v0.5.0

type Source struct {
	File string `xml:"file,attr"`
}

type Target added in v0.5.0

type Target struct {
	Dev string `xml:"dev,attr"`
	Bus string `xml:"bus,attr"`
}

type Type added in v0.5.0

type Type struct {
	Arch    string `xml:"arch,attr"`
	Machine string `xml:"machine,attr"`
	Value   string `xml:",chardata"`
}

type VCPU added in v0.5.0

type VCPU struct {
	Placement string `xml:"placement,attr"`
	Value     int    `xml:",chardata"`
}

Jump to

Keyboard shortcuts

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