Bug 1279344

Summary: Inconsistent PV and PVC bound displayed
Product: OpenShift Container Platform Reporter: Jianwei Hou <jhou>
Component: StorageAssignee: Mark Turansky <mturansk>
Status: CLOSED ERRATA QA Contact: Liang Xia <lxia>
Severity: medium Docs Contact:
Priority: low    
Version: 3.1.0CC: aos-bugs, bchilds, jkrieger, tdawson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 16:25:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jianwei Hou 2015-11-09 08:56:27 UTC
Description of problem:
Delete and create a new PVC with same name before the bound PV is released, the PVC is always shown bound to the PV even if it is not.

Version-Release number of selected component (if applicable):
openshift v3.1.0.2
kubernetes v1.1.0-origin-1107-g4c8e6f4
etcd 2.1.2

How reproducible:
Always

Steps to Reproduce:
1. Create 2 PVs with accessMode RWX and RWO respectively
oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/persistent-volumes/nfs/nfs-default-rwx.json
oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/persistent-volumes/nfs/nfs-recycle-rwo.json

2. Create a PVC with accessMode RWX
oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/persistent-volumes/nfs/claim-rwx.json

3. After the PVC is bound, delete it, immediately before the PV is released, create another PVC with accessMode RWO, the PVC should have same name with the deleted PVC
oc delete pvc nfsc
oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/persistent-volumes/nfs/claim-rwo.json

4. List all PVs: 'oc get pv'
5. List PVC: 'oc get pvc'

Actual results:
After step 4:
The 'oc get pv' shows that 1 PVC bound to 2 different PVs
NAME              LABELS    CAPACITY   ACCESSMODES   STATUS     CLAIM                              REASON    AGE                                                       
nfs               <none>    5Gi        RWX           Bound      jhou/nfsc                                    13m
nfsj              <none>    5Gi        RWO           Bound      jhou/nfsc                                    13m


After step 5:
The PVC is bound to the PV that is RWO

NAME      LABELS    STATUS    VOLUME    CAPACITY   ACCESSMODES   AGE
nfsc      <none>    Bound     nfsj      5Gi        RWO           12m


Expected results:
The PV with accessMode RWX should be in released/available status depending on it's reclaim policy, it should not be shown as 'Bound' to the deleted PVC.

Additional info:

Comment 2 Mark Turansky 2016-01-26 15:57:38 UTC
The bug here is the controller looking at the claim namespace and name when comparing what a volume is bound to.  The 2nd claim used in the example above has the same name/namespace, so the volume sees the existing claim and thinks it is still bound.

The solution is to compare object UIDs instead of namespace/name.

Comment 3 Mark Turansky 2016-01-27 03:45:22 UTC
Bug fix is upstream:  https://github.com/kubernetes/kubernetes/pull/20197

Comment 5 Mark Turansky 2016-02-18 14:23:09 UTC
I verified #20197 is in Origin after the most recent rebase.

Comment 6 Jianwei Hou 2016-02-22 10:50:39 UTC
Verified on:
openshift v3.1.1.903
kubernetes v1.2.0-origin
etcd 2.2.2+git

The issue is not reproducible, the bug is fixed

Comment 8 errata-xmlrpc 2016-05-12 16:25:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2016:1064