Skip to content

Commit 7f85dd3

Browse files
ChanYiLinmergify[bot]
authored andcommitted
fix: fix volume not ready for workload condition
ref: longhorn/longhorn 9938 Signed-off-by: Jack Lin <jack.lin@suse.com>
1 parent 03e82ab commit 7f85dd3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

api/model.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,8 +1491,16 @@ func toVolumeResource(v *longhorn.Volume, ves []*longhorn.Engine, vrs []*longhor
14911491
}
14921492
}
14931493

1494+
allReplicaScheduled := true
1495+
if len(vrs) == 0 {
1496+
allReplicaScheduled = false
1497+
}
14941498
replicas := []Replica{}
14951499
for _, r := range vrs {
1500+
if r.Spec.NodeID == "" {
1501+
allReplicaScheduled = false
1502+
}
1503+
14961504
mode := ""
14971505
if ve != nil && ve.Status.ReplicaModeMap != nil {
14981506
mode = string(ve.Status.ReplicaModeMap[r.Name])
@@ -1568,7 +1576,7 @@ func toVolumeResource(v *longhorn.Volume, ves []*longhorn.Engine, vrs []*longhor
15681576
isCloningDesired := types.IsDataFromVolume(v.Spec.DataSource)
15691577
isCloningCompleted := v.Status.CloneStatus.State == longhorn.VolumeCloneStateCompleted
15701578
if (v.Spec.NodeID == "" && v.Status.State != longhorn.VolumeStateDetached) ||
1571-
(v.Status.State == longhorn.VolumeStateDetached && scheduledCondition.Status != longhorn.ConditionStatusTrue) ||
1579+
(v.Status.State == longhorn.VolumeStateDetached && (scheduledCondition.Status != longhorn.ConditionStatusTrue && !allReplicaScheduled)) ||
15721580
v.Status.Robustness == longhorn.VolumeRobustnessFaulted ||
15731581
v.Status.RestoreRequired ||
15741582
(isCloningDesired && !isCloningCompleted) {

0 commit comments

Comments
 (0)