mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 08:10:20 +00:00
rbd: undo reservation incase of errors
If cephcsi encounters any error after reservation, as a cleanup operation it should revert back the reservation. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
99dbe27921
commit
c40872df00
@ -570,6 +570,15 @@ func RegenerateJournal(imageName, volumeID, pool, journalPool, requestName strin
|
||||
return err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
undoErr := j.UndoReservation(ctx, rbdVol.JournalPool, rbdVol.Pool,
|
||||
rbdVol.RbdImageName, rbdVol.RequestName)
|
||||
if undoErr != nil {
|
||||
util.ErrorLog(ctx, "failed to undo reservation %s: %v", rbdVol, undoErr)
|
||||
}
|
||||
}
|
||||
}()
|
||||
rbdVol.VolID, err = util.GenerateVolID(ctx, rbdVol.Monitors, cr, imagePoolID, rbdVol.Pool,
|
||||
rbdVol.ClusterID, rbdVol.ReservedID, volIDVersion)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user