Skip to content

Commit

Permalink
rbd: setup encryption if rbdVol exits during CreateVol
Browse files Browse the repository at this point in the history
This commit adds code to setup encryption on a rbdVol
being repaired in a followup CreateVolume request.
This is fixes a bug wherein encryption metadata may not
have been set in previous request due to container restart.

Fixes: ceph#3402

Signed-off-by: Rakshith R <rar@redhat.com>
  • Loading branch information
Rakshith-R committed Nov 4, 2022
1 parent 07e9ded commit 4bda0a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,15 @@ func (cs *ControllerServer) repairExistingVolume(ctx context.Context, req *csi.C

return nil, err
}

default:
// setup encryption again to make sure everything is in place.
if rbdVol.isBlockEncrypted() {
err := rbdVol.setupBlockEncryption(ctx)
if err != nil {
return nil, fmt.Errorf("failed to setup encryption for image %s: %w", rbdVol, err)
}
}
}

// Set metadata on restart of provisioner pod when image exist
Expand Down

0 comments on commit 4bda0a5

Please sign in to comment.