From e15e2e5081975072fca6a6f4f7116b111eaaf308 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 3 May 2021 16:30:05 +0530 Subject: [PATCH] rbd: discard image not found error For flatten we call checkImageChainHasFeature which internally calls to getImageInfo returns the parent name even if the parent is in the trash, when we try to open the parent image to get its information it fails as the image not found. we should treat error as nil if the parent is not found. Signed-off-by: Madhu Rajanna --- internal/rbd/rbd_util.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 4333f42d8..d379a45b6 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -719,6 +719,13 @@ func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint } err = vol.getImageInfo() if err != nil { + // call to getImageInfo returns the parent name even if the parent + // is in the trash, when we try to open the parent image to get its + // information it fails because it is already in trash. We should + // treat error as nil if the parent is not found. + if errors.Is(err, ErrImageNotFound) { + return false, nil + } util.ErrorLog(ctx, "failed to get image info for %s: %s", vol, err) return false, err }