Description of problem: After uploading an image with "virtctl image-upload dv ...", as in: ./virtctl image-upload dv larsdv2 --image-path cirros-0.5.1-x86_64-disk.img --storage-class hostpath-provisioner --insecure --size 1Gi The following resources are created: - a persistent volume claim: NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE larsdv2 Bound pvc-9f321068-1a38-4957-80bb-1aa8f655291e 557Gi RWO hostpath-provisioner 40s - a persistent volume: NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-9f321068-1a38-4957-80bb-1aa8f655291e 557Gi RWO Delete Bound default/larsdv2 hostpath-provisioner 58s - a data volume: NAME PHASE PROGRESS AGE larsdv2 Succeeded 77s Attempting to delete the pv returns a "success" message: $ oc delete pv pvc-9f321068-1a38-4957-80bb-1aa8f655291e persistentvolume "pvc-9f321068-1a38-4957-80bb-1aa8f655291e" deleted ...but the command hangs at that point and never exits. The pv goes into the "Terminating" state, and stays there: NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-9f321068-1a38-4957-80bb-1aa8f655291e 557Gi RWO Delete Terminating default/larsdv2 hostpath-provisioner 3m1s Expected results: I expect the "oc delete pv" command to return an error ("pv <pvcname> cannot be deleted because it is in use by another resource").
As far as I understand it, the expected behavior is for the command to complete but the PV to remain in Terminating state until the bound PVC is deleted. @awels, can you try to reproduce this and see if anything strange is happening in the PV deletion path that would prevent the command from completing?
*** Bug 1853429 has been marked as a duplicate of this bug. ***
There is a kubernetes.io/pv-protection finalizer on the PV, to stop people from deleting a PV that is bound to a PVC. Since kubectl delete pv is a foreground delete it will wait until the PV is actually deleted which will not happen because of the finalizer. The deletionTimeStamp is set on the PV as well, so it will get deleted whenever kubernetes is able to do so (aka when the finalizer is gone). The finalizer will be removed when the PV is unbound. All of this is normal kubernetes behavior and not a bug.