From d7e3f06384203df7e8df5974b786ab0da743490e Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 17 Aug 2020 13:37:14 +0530 Subject: [PATCH] cephfs: allow readonly only for volume with contentsource It doesnot make sense to allow the creation of empty volumes with readonly access, this commit allows the creation of volume which is having readonly capabilities only if the content source is set for the volume. Signed-off-by: Madhu Rajanna (cherry picked from commit 860b65c446f2b9c1ddc221c6f378c1d2f71fcbba) --- internal/cephfs/util.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/cephfs/util.go b/internal/cephfs/util.go index 9558b4522..8aa8a875d 100644 --- a/internal/cephfs/util.go +++ b/internal/cephfs/util.go @@ -73,6 +73,12 @@ func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeReq } } + // Allow readonly access mode for volume with content source + err := util.CheckReadOnlyManyIsSupported(req) + if err != nil { + return err + } + if req.VolumeContentSource != nil { volumeSource := req.VolumeContentSource switch volumeSource.Type.(type) {