Summary: PVC meta data should not appear if PV is in available state and after PVC deleted While validating Add metadata information during volume creation and during the lifecycle of the claim https://issues.redhat.com/browse/RHSTOR-3207 while executing below scenarios 1. Enable CSI_ENABLE_METADATA and CSI_ENABLE_OMAP_GENERATOR flag 2. Create pvc object 3. Update persistentVolumeReclaimPolicy:Retain for the PV 4. validate metadata for PVC created 5. Delete the PVC 6. Validate PV for claim pvc_obj is in Released state 7. Edit restore PV and remove the claimRef section 8. Validate PV is in Available state 9. Create another pvc 10. validate metadata for new PVC created #### [root@rdr-cicd-odf-0474-bastion-0 scripts]# oc get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-7290fe85-0373-4faa-a681-f8dc26520a0d 1Gi RWO Retain Bound openshift-storage/rbd-pvc4 ocs-storagecluster-ceph-rbd 24m #### PVC deleted and There are no new PVC created [root@rdr-cicd-odf-0474-bastion-0 scripts]# oc get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE db-noobaa-db-pg-0 Bound pvc-6a58b9e9-b7b5-4591-99f9-53ac9ad9fd57 50Gi RWO ocs-storagecluster-ceph-rbd 7h53m ocs-deviceset-localblock-0-data-08cv25 Bound local-pv-52189c0c 500Gi RWO localblock 7h54m ocs-deviceset-localblock-0-data-1m2jdh Bound local-pv-658d427d 500Gi RWO localblock 7h54m ocs-deviceset-localblock-0-data-29vtcd Bound local-pv-3ac6d77f 500Gi RWO localblock 7h54m rbd-pvc4 Bound pvc-7290fe85-0373-4faa-a681-f8dc26520a0d 1Gi RWO ocs-storagecluster-ceph-rbd 101s ####PV is in available state ##There are no PVC's bound for the PV but still the meta data is shown for it: [root@rdr-cicd-odf-0474-bastion-0 scripts]# oc get pv | grep pvc-7290fe85-0373-4faa-a681-f8dc26520a0d pvc-7290fe85-0373-4faa-a681-f8dc26520a0d 1Gi RWO Retain **Available** ocs-storagecluster-ceph-rbd 30m ### PVC meta data should not appear if there are no PVC associated sh-4.4$ rbd image-meta ls ocs-storagecluster-cephblockpool/csi-vol-4f5efafa-d342-4f1a-99e2-218493fa6961 There are 4 metadata on this image: Key Value csi.ceph.com/cluster/name 24458efb-908c-417d-a0fd-b9d041d6178d csi.storage.k8s.io/pv/name pvc-7290fe85-0373-4faa-a681-f8dc26520a0d **csi.storage.k8s.io/pvc/name rbd-pvc** csi.storage.k8s.io/pvc/namespace openshift-storage