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 <madhupr007@gmail.com>
(cherry picked from commit e15e2e5081)
This commit is contained in:
Madhu Rajanna 2021-05-03 16:30:05 +05:30 committed by mergify[bot]
parent 75fa1927fc
commit 38bd4e613e

View File

@ -719,6 +719,13 @@ func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint
} }
err = vol.getImageInfo() err = vol.getImageInfo()
if err != nil { 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) util.ErrorLog(ctx, "failed to get image info for %s: %s", vol, err)
return false, err return false, err
} }