mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
rbd: pass parent volume to undoSnapshotCloning function
as we are supporting the creation of clone to a new pool we need to pass the correct parent volume to cleanup the snapshot on parent volume. Co-authored-by: Madhu Rajanna <madhupr007@gmail.com> Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
parent
961c1d12fd
commit
e699318acc
@ -844,7 +844,7 @@ func cloneFromSnapshot(ctx context.Context, rbdVol *rbdVolume, rbdSnap *rbdSnaps
|
||||
vol := generateVolFromSnap(rbdSnap)
|
||||
err := vol.Connect(cr)
|
||||
if err != nil {
|
||||
uErr := undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||
uErr := undoSnapshotCloning(ctx, rbdVol, rbdSnap, vol, cr)
|
||||
if uErr != nil {
|
||||
util.WarningLog(ctx, "failed undoing reservation of snapshot: %s %v", rbdSnap.RequestName, uErr)
|
||||
}
|
||||
@ -868,7 +868,7 @@ func cloneFromSnapshot(ctx context.Context, rbdVol *rbdVolume, rbdSnap *rbdSnaps
|
||||
if errors.Is(err, ErrFlattenInProgress) {
|
||||
readyToUse = false
|
||||
} else if err != nil {
|
||||
uErr := undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||
uErr := undoSnapshotCloning(ctx, rbdVol, rbdSnap, vol, cr)
|
||||
if uErr != nil {
|
||||
util.WarningLog(ctx, "failed undoing reservation of snapshot: %s %v", rbdSnap.RequestName, uErr)
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||
err = undoSnapshotCloning(ctx, parentVol, rbdSnap, vol, cr)
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
@ -193,7 +193,7 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
sErr := vol.createSnapshot(ctx, rbdSnap)
|
||||
if sErr != nil {
|
||||
util.ErrorLog(ctx, "failed to create snapshot %s: %v", rbdSnap, sErr)
|
||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||
err = undoSnapshotCloning(ctx, parentVol, rbdSnap, vol, cr)
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
@ -205,13 +205,13 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
sErr := vol.getImageID()
|
||||
if sErr != nil {
|
||||
util.ErrorLog(ctx, "failed to get image id %s: %v", vol, sErr)
|
||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||
err = undoSnapshotCloning(ctx, parentVol, rbdSnap, vol, cr)
|
||||
return false, err
|
||||
}
|
||||
sErr = j.StoreImageID(ctx, vol.JournalPool, vol.ReservedID, vol.ImageID)
|
||||
if sErr != nil {
|
||||
util.ErrorLog(ctx, "failed to store volume id %s: %v", vol, sErr)
|
||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||
err = undoSnapshotCloning(ctx, parentVol, rbdSnap, vol, cr)
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user