scheduler

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 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 {
	DiskUUID                   string
	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) FindDiskCandidates added in v1.7.0

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

FindDiskCandidates identifies suitable disks on eligible nodes for the replica.

Parameters: - replica: The replica for which to find disk candidates. - replicas: The map of existing replicas. - volume: The volume associated with the replica.

Returns: - Map of disk candidates (disk UUID to Disk). - MultiError for non-fatal errors encountered. - Error for any fatal errors encountered.

func (*ReplicaScheduler) GetDiskSchedulingInfo

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

func (*ReplicaScheduler) IsDiskUnderPressure added in v1.7.0

func (rcs *ReplicaScheduler) IsDiskUnderPressure(diskPressurePercentage int64, info *DiskSchedulingInfo) bool

IsDiskUnderPressure checks if the disk is under pressure based the provided threshold percentage.

func (*ReplicaScheduler) IsSchedulableToDisk

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

func (*ReplicaScheduler) IsSchedulableToDiskConsiderDiskPressure added in v1.7.0

func (rcs *ReplicaScheduler) IsSchedulableToDiskConsiderDiskPressure(diskPressurePercentage, size, 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