rbd: update PV/PVC metadata on a reattach of PV

Example if a PVC was delete by setting `persistentVolumeReclaimPolicy` as
`Retain` on PV, and PV is reattached to a new PVC, we make sure to update
PV/PVC image metadata on a PV reattach.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever
2022-02-21 16:54:24 +05:30
committed by mergify[bot]
parent 0119d69ab2
commit ae5925f04c
3 changed files with 37 additions and 2 deletions

View File

@ -177,7 +177,13 @@ func (r ReconcilePersistentVolume) reconcilePV(ctx context.Context, obj runtime.
}
defer cr.DeleteCredentials()
rbdVolID, err := rbd.RegenerateJournal(pv.Spec.CSI.VolumeAttributes, volumeHandler, requestName, pvcNamespace, cr)
rbdVolID, err := rbd.RegenerateJournal(
pv.Spec.CSI.VolumeAttributes,
pv.Spec.ClaimRef.Name,
volumeHandler,
requestName,
pvcNamespace,
cr)
if err != nil {
log.ErrorLogMsg("failed to regenerate journal %s", err)