From 5040fd5e54c3146d09fbd5466f9a05e7b9b08c57 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:39:40 +0000 Subject: [PATCH] Move volume capability Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> --- driver/controller.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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,