From 8f4f42d2e5ef6d47cd606d30e54674a15121833b Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 16 Jan 2019 16:40:24 +0530 Subject: [PATCH] reject block volume creation in cephfs update validate create volume request to reject block volume creation --- pkg/cephfs/util.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/cephfs/util.go b/pkg/cephfs/util.go index 0e0efeddc..e0850b190 100644 --- a/pkg/cephfs/util.go +++ b/pkg/cephfs/util.go @@ -110,10 +110,16 @@ func (cs *controllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeReq return status.Error(codes.InvalidArgument, "Volume Name cannot be empty") } - if req.GetVolumeCapabilities() == nil { + reqCaps := req.GetVolumeCapabilities() + if reqCaps == nil { return status.Error(codes.InvalidArgument, "Volume Capabilities cannot be empty") } + for _, cap := range reqCaps { + if cap.GetBlock() != nil { + return status.Error(codes.Unimplemented, "block volume not supported") + } + } return nil }