Skip to content

Commit

Permalink
rbd: return crypt error for the rpc return
Browse files Browse the repository at this point in the history
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 <hchiramm@redhat.com>
  • Loading branch information
humblec authored and mergify[bot] committed Apr 21, 2021
1 parent 0166817 commit 798437d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down

0 comments on commit 798437d

Please sign in to comment.