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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2023-08-30 09:46:01 +02:00 committed by mergify[bot]
parent e013cfed15
commit 5d034b1124

View File

@ -214,6 +214,7 @@ func checkValidCreateVolumeRequest(
sID *store.SnapshotIdentifier, sID *store.SnapshotIdentifier,
req *csi.CreateVolumeRequest, req *csi.CreateVolumeRequest,
) error { ) error {
volCaps := req.GetVolumeCapabilities()
switch { switch {
case pvID != nil: case pvID != nil:
if vol.Size < parentVol.Size { if vol.Size < parentVol.Size {
@ -224,12 +225,12 @@ func checkValidCreateVolumeRequest(
vol.Size) vol.Size)
} }
if vol.BackingSnapshot { if parentVol.BackingSnapshot && store.IsVolumeCreateRO(volCaps) {
return errors.New("cloning snapshot-backed volumes is currently not supported") return errors.New("creating read-only clone from a snapshot-backed volume is not supported")
} }
case sID != nil: case sID != nil:
if vol.BackingSnapshot { if vol.BackingSnapshot {
volCaps := req.GetVolumeCapabilities()
isRO := store.IsVolumeCreateRO(volCaps) isRO := store.IsVolumeCreateRO(volCaps)
if !isRO { if !isRO {
return errors.New("backingSnapshot may be used only with read-only access modes") return errors.New("backingSnapshot may be used only with read-only access modes")