rbd: check image not found error

during the checkSnapCloneExists we are checking
the image, if the image not found we are deleting
the snapshot on the parent image, This PR corrects
the comparasion. instead of snapshotNotFound we need
to check ImageNotFound error.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-07-07 12:49:05 +05:30 committed by mergify[bot]
parent 953cfa508a
commit 4e82384b43

View File

@ -151,8 +151,8 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
// Fetch on-disk image attributes
err = vol.getImageInfo()
if err != nil {
var esnf ErrSnapNotFound
if errors.As(err, &esnf) {
var einf ErrImageNotFound
if errors.As(err, &einf) {
err = parentVol.deleteSnapshot(ctx, rbdSnap)
if err != nil {
if _, ok := err.(ErrSnapNotFound); !ok {