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 // Fetch on-disk image attributes
err = vol.getImageInfo() err = vol.getImageInfo()
if err != nil { if err != nil {
var esnf ErrSnapNotFound var einf ErrImageNotFound
if errors.As(err, &esnf) { if errors.As(err, &einf) {
err = parentVol.deleteSnapshot(ctx, rbdSnap) err = parentVol.deleteSnapshot(ctx, rbdSnap)
if err != nil { if err != nil {
if _, ok := err.(ErrSnapNotFound); !ok { if _, ok := err.(ErrSnapNotFound); !ok {