diff --git a/controller/volume_controller.go b/controller/volume_controller.go index ca4b22dadb..b675f8fc6b 100644 --- a/controller/volume_controller.go +++ b/controller/volume_controller.go @@ -4836,6 +4836,10 @@ func (c *VolumeController) shouldCleanUpFailedReplica(v *longhorn.Volume, r *lon log.Warnf("Replica %v failed to rebuild too many times", r.Name) return true } + // TODO: Remove it once we can reuse failed replicas during v2 rebuilding + if types.IsDataEngineV2(v.Spec.DataEngine) { + return true + } // Failed too long ago to be useful during a rebuild. if v.Spec.StaleReplicaTimeout > 0 && util.TimestampAfterTimeout(r.Spec.FailedAt, time.Duration(v.Spec.StaleReplicaTimeout)*time.Minute) { diff --git a/scheduler/replica_scheduler.go b/scheduler/replica_scheduler.go index b1c1687814..7ad9403377 100644 --- a/scheduler/replica_scheduler.go +++ b/scheduler/replica_scheduler.go @@ -566,6 +566,11 @@ func filterActiveReplicas(replicas map[string]*longhorn.Replica) map[string]*lon } func (rcs *ReplicaScheduler) CheckAndReuseFailedReplica(replicas map[string]*longhorn.Replica, volume *longhorn.Volume, hardNodeAffinity string) (*longhorn.Replica, error) { + // TODO: Remove it once we can reuse failed replicas during v2 rebuilding + if types.IsDataEngineV2(volume.Spec.DataEngine) { + return nil, nil + } + replicas = filterActiveReplicas(replicas) allNodesInfo, err := rcs.getNodeInfo() @@ -654,6 +659,11 @@ func (rcs *ReplicaScheduler) RequireNewReplica(replicas map[string]*longhorn.Rep return 0 } + // TODO: Remove it once we can reuse failed replicas during v2 rebuilding + if types.IsDataEngineV2(volume.Spec.DataEngine) { + return 0 + } + timeUntilNext, timeOfNext, err := rcs.timeToReplacementReplica(volume) if err != nil { msg := "Failed to get time until replica replacement, will directly replenish a new replica"