Skip to content

Commit

Permalink
Correct wrong check of resulting image sparsiness
Browse files Browse the repository at this point in the history
Following 2168 the check for sparsiness is not always honest.
<EXPLANATION>

Signed-off-by: Alex Kalenyuk <[email protected]>
  • Loading branch information
akalenyu committed Apr 21, 2024
1 parent aab2017 commit 3dc043f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/framework/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,11 @@ func (f *Framework) VerifySparse(namespace *k8sv1.Namespace, pvc *k8sv1.Persiste
return false, err
}
if info.ActualSize-imageContentSize >= units.MiB {
return false, fmt.Errorf("Diff between content size %d and size on disk %d is significant, something's not right", imageContentSize, info.ActualSize)
return false, fmt.Errorf("diff between content size %d and size on disk %d is significant, something's not right", imageContentSize, info.ActualSize)
}
fmt.Fprintf(ginkgo.GinkgoWriter, "INFO: VerifySparse comparison: Virtual: %d vs Content: %d\n", info.VirtualSize, imageContentSize)
return info.VirtualSize >= imageContentSize, nil
// The size a sparse image takes on disk is significantly lower than it's virtual size
return info.VirtualSize-imageContentSize >= units.MiB, nil
}

// VerifyFSOverhead checks whether virtual size is smaller than actual size. That means FS Overhead has been accounted for.
Expand Down

0 comments on commit 3dc043f

Please sign in to comment.