diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 5ef5bb617..e496b64d7 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -95,12 +95,12 @@ func (cs *ControllerServer) parseVolCreateRequest(ctx context.Context, req *csi. isMultiNode := false isBlock := false - for _, cap := range req.VolumeCapabilities { + for _, capability := range req.VolumeCapabilities { // RO modes need to be handled independently (ie right now even if access mode is RO, they'll be RW upon attach) - if cap.GetAccessMode().GetMode() == csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER { + if capability.GetAccessMode().GetMode() == csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER { isMultiNode = true } - if cap.GetBlock() != nil { + if capability.GetBlock() != nil { isBlock = true } } @@ -689,8 +689,8 @@ func (cs *ControllerServer) ValidateVolumeCapabilities(ctx context.Context, req return nil, status.Error(codes.InvalidArgument, "empty volume capabilities in request") } - for _, cap := range req.VolumeCapabilities { - if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER { + for _, capability := range req.VolumeCapabilities { + if capability.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER { return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil } } diff --git a/internal/util/validate.go b/internal/util/validate.go index 81404249b..bc75bd685 100644 --- a/internal/util/validate.go +++ b/internal/util/validate.go @@ -82,8 +82,8 @@ func ValidateNodeUnpublishVolumeRequest(req *csi.NodeUnpublishVolumeRequest) err // CheckReadOnlyManyIsSupported checks the request is to create ReadOnlyMany // volume is from source as empty ReadOnlyMany is not supported. func CheckReadOnlyManyIsSupported(req *csi.CreateVolumeRequest) error { - for _, cap := range req.GetVolumeCapabilities() { - if m := cap.GetAccessMode().Mode; m == csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY || m == csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY { + for _, capability := range req.GetVolumeCapabilities() { + if m := capability.GetAccessMode().Mode; m == csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY || m == csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY { if req.GetVolumeContentSource() == nil { return status.Error(codes.InvalidArgument, "readOnly accessMode is supported only with content source") }