Skip to content

Commit

Permalink
Fix TooManySnapshots error message
Browse files Browse the repository at this point in the history
Longhorn 8668

Signed-off-by: Eric Weber <eric.weber@suse.com>
(cherry picked from commit fd9b061)
  • Loading branch information
ejweber committed Jun 13, 2024
1 parent ee825b1 commit 974980a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1697,10 +1697,13 @@ func (c *VolumeController) requestRemountIfFileSystemReadOnly(v *longhorn.Volume
}

func (c *VolumeController) reconcileVolumeCondition(v *longhorn.Volume, e *longhorn.Engine, rs map[string]*longhorn.Replica, log *logrus.Entry) error {
if len(e.Status.Snapshots) > VolumeSnapshotsWarningThreshold {
numSnapshots := len(e.Status.Snapshots) - 1 // Counting volume-head here would be confusing.
if numSnapshots > VolumeSnapshotsWarningThreshold {
v.Status.Conditions = types.SetCondition(v.Status.Conditions,
longhorn.VolumeConditionTypeTooManySnapshots, longhorn.ConditionStatusTrue,
longhorn.VolumeConditionReasonTooManySnapshots, fmt.Sprintf("Snapshots count is %v over the warning threshold %v", len(e.Status.Snapshots), VolumeSnapshotsWarningThreshold))
longhorn.VolumeConditionReasonTooManySnapshots,
fmt.Sprintf("Snapshots count is %v over the warning threshold %v", numSnapshots,
VolumeSnapshotsWarningThreshold))
} else {
v.Status.Conditions = types.SetCondition(v.Status.Conditions,
longhorn.VolumeConditionTypeTooManySnapshots, longhorn.ConditionStatusFalse,
Expand Down

0 comments on commit 974980a

Please sign in to comment.