diff --git a/driver/controller.go b/driver/controller.go index 96f09a8a..fc6f35b3 100644 --- a/driver/controller.go +++ b/driver/controller.go @@ -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) @@ -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,