Bug 1842964 - volumesnapshot instance can not be deleted when the volumesnapshotcontent instance's deletionpolicy changed from Delete to Retain
Summary: volumesnapshot instance can not be deleted when the volumesnapshotcontent ins...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Storage
Version: 4.5
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.6.0
Assignee: Christian Huffman
QA Contact: Wei Duan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-02 13:04 UTC by Qin Ping
Modified: 2020-10-27 16:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Finalizers are added to VolumeSnapshot objects to prevent their deletion before any associated resources are removed. These finalizers were not updated if the associated VolumeSnapshotContent's deletion policy was updated. Consequence: The VolumeSnapshot object could not be deleted, as the finalizers were never removed. Fix: The logic for finalizers was reworked. These are now correctly removed if the VolumeSnapshotContent's deletion policy is modified. Result: VolumeSnapshot instances can now be deleted successfully if the associated objects are removed.
Clone Of:
Environment:
Last Closed: 2020-10-27 16:03:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-csi-snapshot-controller-operator pull 43 0 None closed Move to a newer version of library-go and external snapshotter 2021-01-14 08:54:25 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:04:20 UTC

Description Qin Ping 2020-06-02 13:04:43 UTC
Description of problem:
volumesnapshot instance can not be deleted when the volumesnapshotcontent instance's deletionpolicy changed from Delete 

Version-Release number of selected component (if applicable):
$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.5.0-0.nightly-2020-05-30-025738   True        False         30h     Cluster version is 4.5.0-0.nightly-2020-05-30-025738

How reproducible:
Always

Steps to Reproduce:
1. Install aws ebs csi driver with operator
2. Create volumesnapshotclass with deletionPolicy=Delete
$ cat volumesnapshotclass.yaml 
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshotClass  
metadata:
  name: csi-aws-ebs-snapclass
  annotations:
    snapshot.storage.kubernetes.io/is-default-class: "true"
driver: ebs.csi.aws.com
deletionPolicy: Delete
3. Create a volumesnapshot instance with this volumesnapshotclass
$ cat volumesnapshot.yaml 
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
  name: mysnapp-2
spec:
  volumeSnapshotClassName: csi-aws-ebs-snapclass
  source:
    persistentVolumeClaimName: pvc2
4. After the volumesnapshotcontent instance becomes ReadyToUse, update the volumesnapshotcontent instance's deletionpolicy from "Delete" to "Retain".
5. Delete the volumesnapshot instance

Actual results:
volumesnapshot instance can not be deleted, after the volumesnapshotcontent instance's deletionpolicy reset to "Delete", the volumesnapshot instance is deleted successfully.

Expected results:
the volumesnapshot instance can be deleted.

Master Log:

Node Log (of failed PODs):

PV Dump:

PVC Dump:

StorageClass Dump (if StorageClass used by PV/PVC):

Additional info:
When creating volumesnapshot instance with a volumesnapshotclass with "Retaion" deletion policy, the volumesnapshot instance can be deleted.

Comment 3 Christian Huffman 2020-06-29 22:16:04 UTC
I submitted a PR [1] to address this upstream. This PR removes the bound Finalizer if the snapshotContent is modified to Retain.

[1] https://github.com/kubernetes-csi/external-snapshotter/pull/327

Comment 5 Christian Huffman 2020-07-13 20:42:39 UTC
I was mistaken previously - it looks like this issue persists up until v2.1.0 upstream. In v2.1.1 and later, this issue is addressed. We'll be able to close this one out once we rebase the external-snapshotter.

Comment 7 Christian Huffman 2020-07-28 14:57:46 UTC
The PR to rebase [1] the CSI snapshot controller operator has been merged into master, which should resolve this issue. Setting to MODIFIED.

[1] https://github.com/openshift/cluster-csi-snapshot-controller-operator/pull/43

Comment 10 Wei Duan 2020-08-07 00:42:34 UTC
Verified pass 

$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.6.0-0.nightly-2020-08-06-131904   True        False         36m     Cluster version is 4.6.0-0.nightly-2020-08-06-131904


1. Create volumesnapshot instance, volumesnapshotcontent is DELETIONPOLICY=Delete
$ oc get volumesnapshot
NAME            READYTOUSE   SOURCEPVC   SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS           SNAPSHOTCONTENT                                    CREATIONTIME   AGE
mysnapshot-01   true         mypvc01                             3Gi           csi-aws-ebs-snapclass   snapcontent-5a1c8435-ef3a-42e6-9d1a-2f1808ce90fe   85s            85s
$ oc get volumeSNAPSHOTCONTENT
NAME                                               READYTOUSE   RESTORESIZE   DELETIONPOLICY   DRIVER            VOLUMESNAPSHOTCLASS     VOLUMESNAPSHOT   AGE
snapcontent-5a1c8435-ef3a-42e6-9d1a-2f1808ce90fe   true         3221225472    Delete           ebs.csi.aws.com   csi-aws-ebs-snapclass   mysnapshot-01    105s

2. Update the volumesnapshotcontent instance's deletionpolicy from "Delete" to "Retain"
$ oc get volumeSNAPSHOTCONTENT
NAME                                               READYTOUSE   RESTORESIZE   DELETIONPOLICY   DRIVER            VOLUMESNAPSHOTCLASS     VOLUMESNAPSHOT   AGE
snapcontent-5a1c8435-ef3a-42e6-9d1a-2f1808ce90fe   true         3221225472    Retain           ebs.csi.aws.com   csi-aws-ebs-snapclass   mysnapshot-01    2m56s

3. Delete volumesnapshot instance successfully, and volumesnapshotcontent is "Retain"
$ oc delete volumesnapshot mysnapshot-01
volumesnapshot.snapshot.storage.k8s.io "mysnapshot-01" deleted
$ oc get volumesnapshot mysnapshot-01
Error from server (NotFound): volumesnapshots.snapshot.storage.k8s.io "mysnapshot-01" not found
$ oc get volumeSNAPSHOTCONTENT
NAME                                               READYTOUSE   RESTORESIZE   DELETIONPOLICY   DRIVER            VOLUMESNAPSHOTCLASS     VOLUMESNAPSHOT   AGE
snapcontent-5a1c8435-ef3a-42e6-9d1a-2f1808ce90fe   true         3221225472    Retain           ebs.csi.aws.com   csi-aws-ebs-snapclass   mysnapshot-01    3m29s

Comment 12 errata-xmlrpc 2020-10-27 16:03:47 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 (OpenShift Container Platform 4.6 GA Images), 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/RHBA-2020:4196


Note You need to log in before you can comment on or make changes to this bug.