mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
Fix returning success from DeleteSnapshot for stale requests
Also reduced code duplication in fetching pool list from Ceph. DeleteSnapshot like DeleteVolume, should return a success when it detects that the snapshot keys are missing from the RADOS OMaps that store the snapshot UUID to request name mapping. This was missing in the code, and is now added. Signed-off-by: ShyamsundarR <srangana@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
1e8fa38879
commit
bc39c523b7
@ -511,6 +511,13 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
|
||||
|
||||
rbdSnap := &rbdSnapshot{}
|
||||
if err = genSnapFromSnapID(rbdSnap, snapshotID, cr); err != nil {
|
||||
// if error is ErrKeyNotFound, then a previous attempt at deletion was complete
|
||||
// or partially complete (snap and snapOMap are garbage collected already), hence return
|
||||
// success as deletion is complete
|
||||
if _, ok := err.(util.ErrKeyNotFound); ok {
|
||||
return &csi.DeleteSnapshotResponse{}, nil
|
||||
}
|
||||
|
||||
// Consider missing snap as already deleted, and proceed to remove the omap values
|
||||
if _, ok := err.(ErrSnapNotFound); !ok {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
|
Reference in New Issue
Block a user