predicates

package
v2.3.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrServerTypeIsNotMatch = `server type is not match`
	ErrExitIsNotMatch       = `exit is not match`
	ErrWireIsNotMatch       = `wire is not match`

	ErrNoPorts               = `no ports`
	ErrNotOwner              = `not owner`
	ErrNoEnoughStorage       = `no enough storage`
	ErrNoAvailableNetwork    = `no available network on this host`
	ErrNoEnoughAvailableGPUs = `no enough available GPUs`
	ErrNotSupportNest        = `nested function not supported`

	ErrRequireMvs                      = `require mvs`
	ErrRequireNoMvs                    = `require not mvs`
	ErrHostIsSpecifiedForMigration     = `host_id specified for migration`
	ErrMoreThanOneSizeUnspecificSplit  = `more than 1 size unspecific split`
	ErrNoMoreSpaceForUnspecificSplit   = `no more space for an unspecific split`
	ErrSubtotalOfSplitExceedsDiskSize  = `subtotal of split exceeds disk size`
	ErrBaremetalHasAlreadyBeenOccupied = `baremetal has already been occupied`

	ErrUnknown = `unknown error`
)

Here are all the errors that may appear in the preselection predicates.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatePredicate

type AggregatePredicate struct {
	BasePredicate
	AggregateHosts    hostsAggregatesMap
	RequireAggregates []api.Aggregate
	ExcludeAggregates []api.Aggregate
	AvoidAggregates   []api.Aggregate
	PreferAggregates  []api.Aggregate
	AggregateMap      map[string]api.Aggregate
}

AggregatePredicate is designed to quickly filter unavailable hosts and improve scheduling efficiency by tabbing whether the host is available.

func (*AggregatePredicate) Clone

func (*AggregatePredicate) Execute

func (*AggregatePredicate) Name

func (p *AggregatePredicate) Name() string

func (*AggregatePredicate) OnSelect

func (p *AggregatePredicate) OnSelect(u *core.Unit, c core.Candidater) bool

func (*AggregatePredicate) OnSelectEnd

func (p *AggregatePredicate) OnSelectEnd(u *core.Unit, c core.Candidater, count int64)

func (*AggregatePredicate) PreExecute

func (p *AggregatePredicate) PreExecute(u *core.Unit, cs []core.Candidater) (bool, error)

type BasePredicate

type BasePredicate struct{}

BasePredicate is a default struct for all the predicates that will include it and implement it's Name() and PreExecute() methods.

func (*BasePredicate) Name

func (b *BasePredicate) Name() string

func (*BasePredicate) PreExecute

func (b *BasePredicate) PreExecute(unit *core.Unit, candis []core.Candidater) (bool, error)

type InsufficientResourceError

type InsufficientResourceError struct {
	// resourceName is the name of the resource that is insufficient
	ResourceName string
	// contains filtered or unexported fields
}

InsufficientResourceError is an error type that indicates what kind of resource limit is hit and caused the unfitting failure.

func NewInsufficientResourceError

func NewInsufficientResourceError(resourceName string, requested, total, free int64) *InsufficientResourceError

func (*InsufficientResourceError) Error

func (ire *InsufficientResourceError) Error() string

func (*InsufficientResourceError) GetReason

func (ire *InsufficientResourceError) GetReason() string

type PredicateHelper

type PredicateHelper struct {
	Unit      *core.Unit
	Candidate core.Candidater
	// contains filtered or unexported fields
}

func NewPredicateHelper

func NewPredicateHelper(pre core.FitPredicate, unit *core.Unit, candi core.Candidater) *PredicateHelper

func (*PredicateHelper) AppendInsufficientResourceError

func (h *PredicateHelper) AppendInsufficientResourceError(req, total, free int64)

func (*PredicateHelper) AppendPredicateFail

func (h *PredicateHelper) AppendPredicateFail(reason core.PredicateFailureReason)

func (*PredicateHelper) AppendPredicateFailMsg

func (h *PredicateHelper) AppendPredicateFailMsg(reason string)

func (*PredicateHelper) BaremetalCandidate

func (h *PredicateHelper) BaremetalCandidate() (*candidate.BaremetalDesc, error)

func (*PredicateHelper) Exclude

func (h *PredicateHelper) Exclude(reason string)

func (*PredicateHelper) Exclude2

func (h *PredicateHelper) Exclude2(predicateName string, current, expected interface{})

func (*PredicateHelper) Get

func (h *PredicateHelper) Get(key string) interface{}

func (*PredicateHelper) GetFailedResult

func (h *PredicateHelper) GetFailedResult(err error) (bool, []core.PredicateFailureReason, error)

func (*PredicateHelper) GetGroupCounts

func (*PredicateHelper) GetInt64

func (h *PredicateHelper) GetInt64(key string, def int64) int64

func (*PredicateHelper) GetResult

func (h *PredicateHelper) GetResult() (bool, []core.PredicateFailureReason, error)

func (*PredicateHelper) HostCandidate

func (h *PredicateHelper) HostCandidate() (*candidate.HostDesc, error)

func (*PredicateHelper) SetCapacity

func (h *PredicateHelper) SetCapacity(capacity int64)

SetCapacity returns the current resource capacity calculated by a filter. And 'capacity' default is -1.

func (*PredicateHelper) SetCapacityCounter

func (h *PredicateHelper) SetCapacityCounter(counter core.Counter)

func (*PredicateHelper) UseReserved

func (h *PredicateHelper) UseReserved() bool

UseReserved check whether the unit can use guest reserved resource

type UnexceptedResourceError

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

func Error

func Error(message string) *UnexceptedResourceError

func NewUnexceptedResourceError

func NewUnexceptedResourceError(message string) *UnexceptedResourceError

func (*UnexceptedResourceError) Error

func (ure *UnexceptedResourceError) Error() string

func (*UnexceptedResourceError) GetReason

func (ure *UnexceptedResourceError) GetReason() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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