rbd: repair encryption config in case it is missing

It is possible that when a provisioner restarts after a snapshot was
cloned, but before the newly restored image had its encryption metadata
set, the new image is not marked as encrypted. This will prevent
attaching/mounting the image, as the encryption key will not be fetched,
or is not available in the DEKStore.

By actively repairing the encryption configuration when needed, this
problem should be addressed.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2021-04-09 10:36:42 +02:00
committed by mergify[bot]
parent 1482105309
commit b1d05a1840
2 changed files with 26 additions and 0 deletions

View File

@ -266,6 +266,11 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
if err != nil {
return nil, err
}
err = rbdSnap.repairEncryptionConfig(&rbdVol.rbdImage)
if err != nil {
return nil, err
}
}
return buildCreateVolumeResponse(req, rbdVol), nil