From eea52847bc33e7adc1e58c837558ff6ddd117e11 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 15 Apr 2021 12:28:58 +0530 Subject: [PATCH] rbd: check volumeID in PV if image not found If the pool or few keys are missing in the omap. GetImageAttributes function returns nil error message and few empty items in imageAttributes struct. if the image is not found and the entiries are missing use the volumeId present on the PV annotation for further operations. Signed-off-by: Madhu Rajanna --- internal/rbd/rbd_util.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index e9346c464..1e5b49973 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -872,7 +872,6 @@ func generateVolumeFromVolumeID(ctx context.Context, volumeID string, cr *util.C if err != nil { return rbdVol, err } - rbdVol.RequestName = imageAttributes.RequestName rbdVol.RbdImageName = imageAttributes.ImageName rbdVol.ReservedID = vi.ObjectUUID @@ -908,7 +907,7 @@ func generateVolumeFromVolumeID(ctx context.Context, volumeID string, cr *util.C // the structure with elements from on-disk image metadata as well. func genVolFromVolID(ctx context.Context, volumeID string, cr *util.Credentials, secrets map[string]string) (*rbdVolume, error) { vol, err := generateVolumeFromVolumeID(ctx, volumeID, cr, secrets) - if !errors.Is(err, util.ErrKeyNotFound) && !errors.Is(err, util.ErrPoolNotFound) { + if !errors.Is(err, util.ErrKeyNotFound) && !errors.Is(err, util.ErrPoolNotFound) && !errors.Is(err, ErrImageNotFound) { return vol, err }