scheduler

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FailedReplicaMaxRetryCount = 5
)

Variables

This section is empty.

Functions

func GetLatestFailedReplica added in v1.1.0

func GetLatestFailedReplica(rs ...*longhorn.Replica) (res *longhorn.Replica)

func IsPotentiallyReusableReplica added in v1.1.0

func IsPotentiallyReusableReplica(r *longhorn.Replica) bool

IsPotentiallyReusableReplica checks if a failed replica is potentially reusable. A potentially reusable replica means this failed replica may be able to reuse it later but it’s not valid now due to node/disk down issue.

Types

type Disk

type Disk struct {
	longhorn.DiskSpec
	*longhorn.DiskStatus
	NodeID string
}

type DiskSchedulingInfo

type DiskSchedulingInfo struct {
	StorageAvailable           int64
	StorageMaximum             int64
	StorageReserved            int64
	StorageScheduled           int64
	OverProvisioningPercentage int64
	MinimalAvailablePercentage int64
}

type ReplicaScheduler

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

func NewReplicaScheduler

func NewReplicaScheduler(ds *datastore.DataStore) *ReplicaScheduler

func (*ReplicaScheduler) CheckAndReuseFailedReplica added in v1.1.0

func (rcs *ReplicaScheduler) CheckAndReuseFailedReplica(replicas map[string]*longhorn.Replica, volume *longhorn.Volume, hardNodeAffinity string) (*longhorn.Replica, error)

func (*ReplicaScheduler) CheckReplicasSizeExpansion added in v1.2.1

func (rcs *ReplicaScheduler) CheckReplicasSizeExpansion(v *longhorn.Volume, oldSize, newSize int64) (diskScheduleMultiError util.MultiError, err error)

func (*ReplicaScheduler) FilterNodesSchedulableForVolume added in v1.5.4

func (rcs *ReplicaScheduler) FilterNodesSchedulableForVolume(nodes map[string]*longhorn.Node, volume *longhorn.Volume) map[string]*longhorn.Node

FilterNodesSchedulableForVolume filters nodes that are schedulable for a given volume based on the disk space.

func (*ReplicaScheduler) GetDiskSchedulingInfo

func (rcs *ReplicaScheduler) GetDiskSchedulingInfo(disk longhorn.DiskSpec, diskStatus *longhorn.DiskStatus) (*DiskSchedulingInfo, error)

func (*ReplicaScheduler) IsSchedulableToDisk

func (rcs *ReplicaScheduler) IsSchedulableToDisk(size int64, requiredStorage int64, info *DiskSchedulingInfo) bool

func (*ReplicaScheduler) RequireNewReplica added in v1.1.0

func (rcs *ReplicaScheduler) RequireNewReplica(replicas map[string]*longhorn.Replica, volume *longhorn.Volume, hardNodeAffinity string) time.Duration

RequireNewReplica is used to check if creating new replica immediately is necessary **after a reusable failed replica is not found**. If creating new replica immediately is necessary, returns 0. Otherwise, returns the duration that the caller should recheck. A new replica needs to be created when:

  1. the volume is a new volume (volume.Status.Robustness is Empty)
  2. data locality is required (hardNodeAffinity is not Empty and volume.Status.Robustness is Healthy)
  3. replica eviction happens (volume.Status.Robustness is Healthy)
  4. there is no potential reusable replica
  5. there is potential reusable replica but the replica replenishment wait interval is passed.

func (*ReplicaScheduler) ScheduleReplica

func (rcs *ReplicaScheduler) ScheduleReplica(replica *longhorn.Replica, replicas map[string]*longhorn.Replica, volume *longhorn.Volume) (*longhorn.Replica, util.MultiError, error)

ScheduleReplica will return (nil, nil) for unschedulable replica

Jump to

Keyboard shortcuts

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