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
  • Loading branch information
Jian Cheng committed Oct 8, 2023
1 parent 45ebdf6 commit ea645f9
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 ea645f9

Please sign in to comment.