Skip to content

Commit ad5f830

Browse files
authored
Merge pull request #364 from kubernetes-csi/fix-unnecessary-resize-error
fix: unnecessary resize volume error
2 parents 6602322 + 3871187 commit ad5f830

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/os/volume/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ func (VolumeAPI) ResizeVolume(volumeID string, size int64) error {
197197
return fmt.Errorf("error getting the current size of volume (%s) with error (%v)", volumeID, err)
198198
}
199199

200-
//if the partition's size is already the size we want this is a noop, just return
201-
if currentSize >= finalSize {
202-
klog.V(2).Infof("Attempted to resize volume %s to a lower size, from currentBytes=%d wantedBytes=%d", volumeID, currentSize, finalSize)
200+
// only resize if finalSize - currentSize is greater than 100MB
201+
if finalSize-currentSize < 100*1024*1024 {
202+
klog.V(2).Infof("minimum resize difference(1GB) not met, skipping resize. volumeID=%s currentSize=%d finalSize=%d", volumeID, currentSize, finalSize)
203203
return nil
204204
}
205205

0 commit comments

Comments
 (0)