mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
rbd: use different variable instead of builtin cap
function
`cap` builtin function returns the capacity of a type. Its not good practice to use this builtin function for other variable names, removing it here Ref# https://golang.org/pkg/builtin/#cap Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
2d70e25081
commit
25617929f0
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user