Skip to content

Commit

Permalink
fix: fix backing image size calculation
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 10342

Signed-off-by: Jack Lin <[email protected]>
  • Loading branch information
ChanYiLin authored and shuo-wu committed Feb 10, 2025
1 parent d00c2a1 commit b5b59bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/spdk/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (s *Server) verify() (err error) {
logrus.WithError(err).Warnf("failed to extract backing image name and disk UUID from lvol name %v", lvolName)
continue
}
actualSize := bdevLvol.DriverSpecific.Lvol.NumAllocatedClusters * uint64(defaultClusterSize)
size := bdevLvol.NumBlocks * uint64(bdevLvol.BlockSize)
alias := bdevLvol.Aliases[0]
expectedChecksum, err := GetSnapXattr(spdkClient, alias, types.BackingImageSnapshotAttrChecksum)
if err != nil {
Expand All @@ -298,7 +298,7 @@ func (s *Server) verify() (err error) {
logrus.WithError(err).Warnf("failed to retrieve backing image UUID attribute for snapshot %v", alias)
continue
}
backingImage := NewBackingImage(s.ctx, backingImageName, backingImageUUID, lvsUUID, actualSize, expectedChecksum, s.updateChs[types.InstanceTypeBackingImage])
backingImage := NewBackingImage(s.ctx, backingImageName, backingImageUUID, lvsUUID, size, expectedChecksum, s.updateChs[types.InstanceTypeBackingImage])
backingImage.Alias = alias
// For uncahced backing image, we set the state to pending first, so we can distinguish it from the cached but starting backing image
backingImage.State = types.BackingImageStatePending
Expand Down

0 comments on commit b5b59bf

Please sign in to comment.