mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
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:
@ -29,10 +29,14 @@ import (
|
||||
"github.com/ceph/ceph-csi/internal/util/log"
|
||||
)
|
||||
|
||||
// createRBDClone creates a clone of the parentVol by creating a
|
||||
// snapshot of the parentVol and cloning the snapshot to the cloneRbdVol.
|
||||
// If deleteSnap is true, the snapshot is deleted after the clone is created.
|
||||
func createRBDClone(
|
||||
ctx context.Context,
|
||||
parentVol, cloneRbdVol *rbdVolume,
|
||||
snap *rbdSnapshot,
|
||||
deleteSnap bool,
|
||||
) error {
|
||||
// create snapshot
|
||||
err := parentVol.createSnapshot(ctx, snap)
|
||||
@ -58,6 +62,10 @@ func createRBDClone(
|
||||
snap.RbdSnapName,
|
||||
err)
|
||||
}
|
||||
if !deleteSnap {
|
||||
return nil
|
||||
}
|
||||
|
||||
errSnap := parentVol.deleteSnapshot(ctx, snap)
|
||||
if errSnap != nil {
|
||||
log.ErrorLog(ctx, "failed to delete snapshot: %v", errSnap)
|
||||
|
Reference in New Issue
Block a user