Skip to content

Commit

Permalink
Merge pull request #4389 from liulanzheng/master
Browse files Browse the repository at this point in the history
fix usage loss for snapshots with labels in MergeSnapshotter
  • Loading branch information
sipsma authored Nov 3, 2023
2 parents 36c5550 + 6fe2ee8 commit 257622c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions snapshot/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,25 @@ func mergeUsageOf(info snapshots.Info) (usage snapshots.Usage, ok bool, rerr err
if info.Labels == nil {
return snapshots.Usage{}, false, nil
}
hasMergeUsageLabel := false
if str, ok := info.Labels[mergeUsageSizeLabel]; ok {
i, err := strconv.Atoi(str)
if err != nil {
return snapshots.Usage{}, false, err
}
usage.Size = int64(i)
hasMergeUsageLabel = true
}
if str, ok := info.Labels[mergeUsageInodesLabel]; ok {
i, err := strconv.Atoi(str)
if err != nil {
return snapshots.Usage{}, false, err
}
usage.Inodes = int64(i)
hasMergeUsageLabel = true
}
if !hasMergeUsageLabel {
return snapshots.Usage{}, false, nil
}
return usage, true, nil
}

0 comments on commit 257622c

Please sign in to comment.