framework

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithMap

func ContextWithMap(ctx context.Context, m map[string]string) context.Context

bind map's key-value to context key-value. type of key is translated to CtxKey type

Types

type CtxKey

type CtxKey string

type CycleState

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

func NewCycleState

func NewCycleState() CycleState

func (*CycleState) Error

func (c *CycleState) Error() error

func (*CycleState) IsCompleted

func (c *CycleState) IsCompleted() bool

func (*CycleState) Messages

func (c *CycleState) Messages() map[string]string

func (*CycleState) Result

func (c *CycleState) Result() SchedulerResult

func (*CycleState) SetComplete

func (c *CycleState) SetComplete()

func (*CycleState) SetError

func (c *CycleState) SetError(err error)

func (*CycleState) SetMessage

func (c *CycleState) SetMessage(pluginName, message string)

func (*CycleState) UpdateState

func (c *CycleState) UpdateState(completed bool, err error, result SchedulerResult)

type NodeFilterPlugin

type NodeFilterPlugin interface {
	Plugin
	Filter(ctx context.Context, state *CycleState, config api.VirtualMachineCreateOptions, nodeInfo *NodeInfo) *Status
}

type NodeInfo

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

NodeInfo is node level aggregated information

func GetNodeInfoList

func GetNodeInfoList(ctx context.Context, client *proxmox.Service) ([]*NodeInfo, error)

func (NodeInfo) Node

func (n NodeInfo) Node() *api.Node

func (NodeInfo) QEMUs

func (n NodeInfo) QEMUs() []*api.VirtualMachine

type NodeScore

type NodeScore struct {
	Name  string
	Score int64
}

NodeScore is a struct with node name and score.

type NodeScoreList

type NodeScoreList []NodeScore

NodeScoreList declares a list of nodes and their scores.

type NodeScorePlugin

type NodeScorePlugin interface {
	Plugin
	Score(ctx context.Context, state *CycleState, config api.VirtualMachineCreateOptions, nodeInfo *NodeInfo) (int64, *Status)
}

type Plugin

type Plugin interface {
	// return plugin name
	Name() string
}

type SchedulerResult

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

func NewSchedulerResult

func NewSchedulerResult(vmid int, node string, storage string) SchedulerResult

func (*SchedulerResult) Node

func (r *SchedulerResult) Node() string

func (*SchedulerResult) Storage added in v0.3.7

func (r *SchedulerResult) Storage() string

func (*SchedulerResult) VMID

func (r *SchedulerResult) VMID() int

type Status

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

func NewStatus

func NewStatus() *Status

func (*Status) Code

func (s *Status) Code() int

func (*Status) Error

func (s *Status) Error() error

func (*Status) FailedPlugin

func (s *Status) FailedPlugin() string

func (*Status) IsSuccess

func (s *Status) IsSuccess() bool

func (*Status) Reasons

func (s *Status) Reasons() []string

func (*Status) SetCode

func (s *Status) SetCode(code int)

func (*Status) SetFailedPlugin

func (s *Status) SetFailedPlugin(name string)

type VMIDPlugin

type VMIDPlugin interface {
	Plugin
	PluginKey() CtxKey
	Select(ctx context.Context, state *CycleState, config api.VirtualMachineCreateOptions, nextid int, usedID map[int]bool) (int, error)
}

Jump to

Keyboard shortcuts

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