Skip to content

Commit

Permalink
Changed the logic for comparing volsize and updatesize when scaling up.
Browse files Browse the repository at this point in the history
Signed-off-by: Esimest <[email protected]>
  • Loading branch information
Jian Cheng authored and esimest committed Oct 8, 2023
1 parent 45ebdf6 commit 3e5c37e
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,20 +553,17 @@ func (cs *controller) ControllerExpandVolume(
* to the specified volume ID is already larger than or equal to the target
* capacity of the expansion request, the plugin should reply 0 OK.
*/
if volsize >= updatedSize {
return csipayload.NewControllerExpandVolumeResponseBuilder().
WithCapacityBytes(volsize).
Build(), nil
}

if err := lvm.ResizeVolume(vol, updatedSize); err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to handle ControllerExpandVolumeRequest for %s, {%s}",
volumeID,
err.Error(),
)
if volsize < updatedSize {
if err := lvm.ResizeVolume(vol, updatedSize); err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to handle ControllerExpandVolumeRequest for %s, {%s}",
volumeID,
err.Error(),
)
}
}

return csipayload.NewControllerExpandVolumeResponseBuilder().
WithCapacityBytes(updatedSize).
WithNodeExpansionRequired(true).
Expand Down

0 comments on commit 3e5c37e

Please sign in to comment.