rbd: add EnsureImageCleanup to snapshot deletion

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2021-10-05 16:40:51 +05:30 committed by mergify[bot]
parent 1849076aab
commit 12cd05a408

View File

@ -1383,7 +1383,12 @@ func (cs *ControllerServer) DeleteSnapshot(
err = rbdVol.getImageInfo() err = rbdVol.getImageInfo()
if err != nil { 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) 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()) return nil, status.Error(codes.Internal, err.Error())