mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
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:
committed by
mergify[bot]
parent
0119d69ab2
commit
ae5925f04c
@ -63,3 +63,19 @@ func GetVolumeMetadata(parameters map[string]string) map[string]string {
|
||||
|
||||
return newParam
|
||||
}
|
||||
|
||||
// PrepareVolumeMetadata return PV/PVC/PVCNamespace metadata based on inputs.
|
||||
func PrepareVolumeMetadata(pvcName, pvcNamespace, pvName string) map[string]string {
|
||||
newParam := map[string]string{}
|
||||
if pvcName != "" {
|
||||
newParam[pvcNameKey] = pvcName
|
||||
}
|
||||
if pvcNamespace != "" {
|
||||
newParam[pvcNamespaceKey] = pvcNamespace
|
||||
}
|
||||
if pvName != "" {
|
||||
newParam[pvNameKey] = pvName
|
||||
}
|
||||
|
||||
return newParam
|
||||
}
|
||||
|
Reference in New Issue
Block a user