From bea9d561176c23a174b3611cec370c956d49247d Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 31 Mar 2021 15:22:26 +0200 Subject: [PATCH] rbd: copyEncryptionConfig in doSnapshotClone() Signed-off-by: Niels de Vos --- internal/rbd/controllerserver.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 4ecce24c1..6244691d1 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -928,6 +928,16 @@ func (cs *ControllerServer) doSnapshotClone(ctx context.Context, parentVol *rbdV } }() + if parentVol.isEncrypted() { + cryptErr := parentVol.copyEncryptionConfig(&cloneRbd.rbdImage) + if cryptErr != nil { + util.WarningLog(ctx, "failed copy encryption "+ + "config for %q: %v", cloneRbd.String(), cryptErr) + return ready, nil, status.Errorf(codes.Internal, + err.Error()) + } + } + err = cloneRbd.createSnapshot(ctx, rbdSnap) if err != nil { // update rbd image name for logging