From 12cd05a408ab0eafe8a9de35777558ab817cb849 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Tue, 5 Oct 2021 16:40:51 +0530 Subject: [PATCH] rbd: add EnsureImageCleanup to snapshot deletion Signed-off-by: Rakshith R --- internal/rbd/controllerserver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index ecb290547..813634592 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -1383,7 +1383,12 @@ func (cs *ControllerServer) DeleteSnapshot( err = rbdVol.getImageInfo() if err != nil { - if !errors.Is(err, ErrImageNotFound) { + if errors.Is(err, ErrImageNotFound) { + err = rbdVol.ensureImageCleanup(ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + } else { log.ErrorLog(ctx, "failed to delete rbd image: %s/%s with error: %v", rbdVol.Pool, rbdVol.VolName, err) return nil, status.Error(codes.Internal, err.Error())