Documentation ¶
Index ¶
- Constants
- func GetLatestFailedReplica(rs ...*longhorn.Replica) (res *longhorn.Replica)
- func IsPotentiallyReusableReplica(r *longhorn.Replica) bool
- type Disk
- type DiskSchedulingInfo
- type ReplicaScheduler
- func (rcs *ReplicaScheduler) CheckAndReuseFailedReplica(replicas map[string]*longhorn.Replica, volume *longhorn.Volume, ...) (*longhorn.Replica, error)
- func (rcs *ReplicaScheduler) CheckReplicasSizeExpansion(v *longhorn.Volume, oldSize, newSize int64) (diskScheduleMultiError util.MultiError, err error)
- func (rcs *ReplicaScheduler) FilterNodesSchedulableForVolume(nodes map[string]*longhorn.Node, volume *longhorn.Volume) map[string]*longhorn.Node
- func (rcs *ReplicaScheduler) FindDiskCandidates(replica *longhorn.Replica, replicas map[string]*longhorn.Replica, ...) (map[string]*Disk, util.MultiError, error)
- func (rcs *ReplicaScheduler) GetDiskSchedulingInfo(disk longhorn.DiskSpec, diskStatus *longhorn.DiskStatus) (*DiskSchedulingInfo, error)
- func (rcs *ReplicaScheduler) IsDiskUnderPressure(diskPressurePercentage int64, info *DiskSchedulingInfo) bool
- func (rcs *ReplicaScheduler) IsSchedulableToDisk(size int64, requiredStorage int64, info *DiskSchedulingInfo) bool
- func (rcs *ReplicaScheduler) IsSchedulableToDiskConsiderDiskPressure(diskPressurePercentage, size, requiredStorage int64, info *DiskSchedulingInfo) bool
- func (rcs *ReplicaScheduler) RequireNewReplica(replicas map[string]*longhorn.Replica, volume *longhorn.Volume, ...) time.Duration
- func (rcs *ReplicaScheduler) ScheduleReplica(replica *longhorn.Replica, replicas map[string]*longhorn.Replica, ...) (*longhorn.Replica, util.MultiError, error)
Constants ¶
const (
FailedReplicaMaxRetryCount = 5
)
Variables ¶
This section is empty.
Functions ¶
func GetLatestFailedReplica ¶ added in v1.1.0
func IsPotentiallyReusableReplica ¶ added in v1.1.0
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 DiskSchedulingInfo ¶
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 (*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:
- the volume is a new volume (volume.Status.Robustness is Empty)
- data locality is required (hardNodeAffinity is not Empty and volume.Status.Robustness is Healthy)
- replica eviction happens (volume.Status.Robustness is Healthy)
- there is no potential reusable replica
- 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