Skip to content

Commit

Permalink
Move volume capability
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
  • Loading branch information
pierre-emmanuelJ committed Jan 23, 2024
1 parent afb159c commit 5040fd5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,19 @@ func (d *controllerService) ControllerExpandVolume(ctx context.Context, req *csi
return nil, err
}

nodeExpansionRequired := true
volumeCapability := req.GetVolumeCapability()
if volumeCapability != nil {
err := validateVolumeCapability(volumeCapability)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "volumeCapabilities not supported: %s", err)
}

if _, ok := volumeCapability.GetAccessType().(*csi.VolumeCapability_Block); ok {
nodeExpansionRequired = false
}
}

newSize, err := getNewVolumeSize(req.GetCapacityRange())
if err != nil {
return nil, status.Errorf(codes.OutOfRange, "invalid capacity range: %v", err)
Expand All @@ -638,19 +651,6 @@ func (d *controllerService) ControllerExpandVolume(ctx context.Context, req *csi
return nil, err
}

nodeExpansionRequired := true
volumeCapability := req.GetVolumeCapability()
if volumeCapability != nil {
err := validateVolumeCapability(volumeCapability)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "volumeCapabilities not supported: %s", err)
}

if _, ok := volumeCapability.GetAccessType().(*csi.VolumeCapability_Block); ok {
nodeExpansionRequired = false
}
}

return &csi.ControllerExpandVolumeResponse{
CapacityBytes: newSize,
NodeExpansionRequired: nodeExpansionRequired,
Expand Down

0 comments on commit 5040fd5

Please sign in to comment.