Skip to content

Commit

Permalink
Merge pull request #364 from kubernetes-csi/fix-unnecessary-resize-error
Browse files Browse the repository at this point in the history
fix: unnecessary resize volume error
  • Loading branch information
k8s-ci-robot authored Dec 18, 2024
2 parents 6602322 + 3871187 commit ad5f830
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/os/volume/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ func (VolumeAPI) ResizeVolume(volumeID string, size int64) error {
return fmt.Errorf("error getting the current size of volume (%s) with error (%v)", volumeID, err)
}

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

Expand Down

0 comments on commit ad5f830

Please sign in to comment.