From 5d034b11242d5d3e7bd77976e450ef089af28a8e Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 30 Aug 2023 09:46:01 +0200 Subject: [PATCH] cephfs: block creation of ROX clone from ROX volume As there is no usecase currently, blocking the creation of ROX clone from the ROX volume. Signed-off-by: Madhu Rajanna --- internal/cephfs/controllerserver.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cephfs/controllerserver.go b/internal/cephfs/controllerserver.go index 873b8175c..ce4c19dc5 100644 --- a/internal/cephfs/controllerserver.go +++ b/internal/cephfs/controllerserver.go @@ -214,6 +214,7 @@ func checkValidCreateVolumeRequest( sID *store.SnapshotIdentifier, req *csi.CreateVolumeRequest, ) error { + volCaps := req.GetVolumeCapabilities() switch { case pvID != nil: if vol.Size < parentVol.Size { @@ -224,12 +225,12 @@ func checkValidCreateVolumeRequest( vol.Size) } - if vol.BackingSnapshot { - return errors.New("cloning snapshot-backed volumes is currently not supported") + if parentVol.BackingSnapshot && store.IsVolumeCreateRO(volCaps) { + return errors.New("creating read-only clone from a snapshot-backed volume is not supported") } + case sID != nil: if vol.BackingSnapshot { - volCaps := req.GetVolumeCapabilities() isRO := store.IsVolumeCreateRO(volCaps) if !isRO { return errors.New("backingSnapshot may be used only with read-only access modes")