rbd: retain intermediate RBD snapshot on temp image

Currently, Ceph-CSI deletes intermediate RBD snapshot on
temporary cloned images (`csi-vol-xxxx-temp@csi-vol-xxxx`)
which is the parent of the final clone image.

The parent-child mirroring requires both the parent and child
images to be present (i.e, not in trash).

This commit makes enhancement to `createRBDClone` function by
introducing `deleteSnap` parameter. If `deleteSnap` is true,
the snapshot is deleted after the clone is created.

This is required to support mirroring of child image with its
parent image.

Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
Praveen M
2024-11-08 14:01:53 +05:30
committed by mergify[bot]
parent 9a64ca91a9
commit 0ed0af120b
4 changed files with 33 additions and 18 deletions

View File

@ -1388,7 +1388,8 @@ func (cs *ControllerServer) doSnapshotClone(
return cloneRbd, err
}
err = createRBDClone(ctx, parentVol, cloneRbd, rbdSnap)
// create snapshot, clone and delete snapshot
err = createRBDClone(ctx, parentVol, cloneRbd, rbdSnap, true)
if err != nil {
log.ErrorLog(ctx, "failed to create snapshot: %v", err)