Skip to content

Commit

Permalink
fix(volume): wrong volume scheduled condition
Browse files Browse the repository at this point in the history
longhorn/longhorn-8867

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and derekbit committed Jul 3, 2024
1 parent a13e767 commit 2237416
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ func (c *VolumeController) reconcileVolumeCondition(v *longhorn.Volume, e *longh
}

failureMessage := ""
if scheduled {
if scheduled && len(rs) >= v.Spec.NumberOfReplicas {
v.Status.Conditions = types.SetCondition(v.Status.Conditions,
longhorn.VolumeConditionTypeScheduled, longhorn.ConditionStatusTrue, "", "")
} else if v.Status.CurrentNodeID == "" {
Expand Down Expand Up @@ -2249,6 +2249,9 @@ func (c *VolumeController) replenishReplicas(v *longhorn.Volume, e *longhorn.Eng

if err := c.precheckCreateReplica(newReplica, rs, v); err != nil {
log.WithError(err).Warnf("Unable to create new replica %v", newReplica.Name)
v.Status.Conditions = types.SetCondition(v.Status.Conditions,
longhorn.VolumeConditionTypeScheduled, longhorn.ConditionStatusFalse,
longhorn.VolumeConditionReasonReplicaSchedulingFailure, longhorn.ErrorReplicaSchedulePrecheckNewReplicaFailed)
continue
}

Expand Down
1 change: 1 addition & 0 deletions k8s/pkg/apis/longhorn/v1beta2/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
ErrorReplicaScheduleEngineImageNotReady = "none of the node candidates contains a ready engine image"
ErrorReplicaScheduleHardNodeAffinityNotSatisfied = "hard affinity cannot be satisfied"
ErrorReplicaScheduleSchedulingFailed = "replica scheduling failed"
ErrorReplicaSchedulePrecheckNewReplicaFailed = "precheck new replica failed"
)

type DiskType string
Expand Down

0 comments on commit 2237416

Please sign in to comment.