Skip to content

Commit

Permalink
fix: ignore backing image real size inconsistency between nodes
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 9976

Signed-off-by: Jack Lin <[email protected]>
  • Loading branch information
ChanYiLin authored and derekbit committed Dec 23, 2024
1 parent 6adf428 commit fb9c6ca
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions controller/backing_image_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1340,20 +1340,13 @@ func (bic *BackingImageController) syncBackingImageFileInfo(bi *longhorn.Backing
}
}
}
// We found that the real size may change when syncing with other nodes, while the checksum remains the same
// Since we have already verified that the checksum is correct, we can ignore the discrepancy in the real size.
if info.RealSize > 0 {
if bi.Status.RealSize == 0 {
bi.Status.RealSize = info.RealSize
bic.eventRecorder.Eventf(bi, corev1.EventTypeNormal, constant.EventReasonUpdate, "Set realSize to %v", bi.Status.RealSize)
}
if bi.Status.RealSize != info.RealSize {
if bi.Status.DiskFileStatusMap[bim.Spec.DiskUUID].State != longhorn.BackingImageStateFailed {
msg := fmt.Sprintf("found mismatching realSize %v reported by backing image manager %v in disk %v, the realSize recorded in status is %v",
info.RealSize, bim.Name, bim.Spec.DiskUUID, bi.Status.RealSize)
bic.eventRecorder.Eventf(bi, corev1.EventTypeWarning, constant.EventReasonUpdate, msg)
bi.Status.DiskFileStatusMap[bim.Spec.DiskUUID].State = longhorn.BackingImageStateFailed
bi.Status.DiskFileStatusMap[bim.Spec.DiskUUID].Message = msg
}
}
}
}

Expand Down

0 comments on commit fb9c6ca

Please sign in to comment.