From 798437d0c4cc970187f65ec110684b597f98cf49 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Wed, 21 Apr 2021 18:01:17 +0530 Subject: [PATCH] rbd: return crypt error for the rpc return At present we return the volume connect error if the clone from snapshot fails when rbdvolume is encrypted, which is incorrect. This patch correctly return the failed copy encryption error to the caller Signed-off-by: Humble Chirammal --- internal/rbd/controllerserver.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index dc328ee032e..43acce5126a 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -811,13 +811,9 @@ func cloneFromSnapshot(ctx context.Context, rbdVol *rbdVolume, rbdSnap *rbdSnaps if rbdVol.isEncrypted() { // FIXME: vol.VolID should be different from rbdVol.VolID vol.VolID = rbdVol.VolID - cryptErr := rbdVol.copyEncryptionConfig(&vol.rbdImage) - if cryptErr != nil { - util.WarningLog(ctx, "failed copy encryption "+ - "config for %q: %v", vol.String(), - rbdSnap.RequestName, cryptErr) - return nil, status.Errorf(codes.Internal, - err.Error()) + err = rbdVol.copyEncryptionConfig(&vol.rbdImage) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } }