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,
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")