mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #58617 from humblec/expand-idmpt
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Make ExpandVolumeDevice() idempotent if existing volume capacity meets the requested size. Signed-off-by: Humble Chirammal <hchiramm@redhat.com> **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note ```
This commit is contained in:
commit
175df0cba0
@ -1132,6 +1132,21 @@ func (plugin *glusterfsPlugin) ExpandVolumeDevice(spec *volume.Spec, newSize res
|
||||
expansionSize := (newSize.Value() - oldSize.Value())
|
||||
expansionSizeGiB := int(volume.RoundUpSize(expansionSize, volume.GIB))
|
||||
|
||||
// Find out requested Size
|
||||
|
||||
requestGiB := volume.RoundUpToGiB(newSize)
|
||||
|
||||
//Check the existing volume size
|
||||
currentVolumeInfo, err := cli.VolumeInfo(volumeID)
|
||||
if err != nil {
|
||||
glog.Errorf("error when fetching details of volume :%v", err)
|
||||
return oldSize, err
|
||||
}
|
||||
|
||||
if int64(currentVolumeInfo.Size) >= requestGiB {
|
||||
return newSize, nil
|
||||
}
|
||||
|
||||
// Make volume expansion request
|
||||
volumeExpandReq := &gapi.VolumeExpandRequest{Size: expansionSizeGiB}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user