Skip to content

Commit e7788ef

Browse files
author
Bob Furu
authored
Merge pull request #29475 from bobfuru/BZ1896084
2 parents 7dc6f47 + b484bf1 commit e7788ef

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

modules/persistent-storage-csi-snapshots-delete.adoc

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ You can configure how {product-title} deletes volume snapshots.
99

1010
.Procedure
1111

12-
To enable deletion of a volume snapshot in a cluster:
13-
1412
. Specify the deletion policy that you require in the `VolumeSnapshotClass` object, as shown in the following example:
15-
1613
+
1714
.volumesnapshotclass.yaml
1815
[source,yaml]
@@ -24,6 +21,47 @@ metadata:
2421
driver: hostpath.csi.k8s.io
2522
deletionPolicy: Delete <1>
2623
----
27-
<1> If the `Delete` value is set, the underlying snapshot will be deleted, along with the `VolumeSnapshotContent` object. If the `Retain` value is set, both the underlying snapshot and `VolumeSnapshotContent` object remain.
24+
<1> When deleting the volume snapshot, if the `Delete` value is set, the underlying snapshot is deleted along with the `VolumeSnapshotContent` object. If the `Retain` value is set, both the underlying snapshot and `VolumeSnapshotContent` object remain.
2825
+
29-
If the `Retain` value is set, and the `VolumeSnapshot` object is deleted without deleting the corresponding `VolumeSnapshotContent` object, then the content will remain. The snapshot itself is also retained in the storage back end.
26+
If the `Retain` value is set and the `VolumeSnapshot` object is deleted without deleting the corresponding `VolumeSnapshotContent` object, the content remains. The snapshot itself is also retained in the storage back end.
27+
28+
. Delete the volume snapshot by entering the following command:
29+
30+
+
31+
[source,terminal]
32+
----
33+
$ oc delete volumesnapshot <volumesnapshot_name>
34+
----
35+
+
36+
.Example output
37+
[source, terminal]
38+
----
39+
volumesnapshot.snapshot.storage.k8s.io "mysnapshot" deleted
40+
----
41+
. If the deletion policy is set to `Retain`, delete the volume snapshot content by entering the following command:
42+
+
43+
[source,terminal]
44+
----
45+
$ oc delete volumesnapshotcontent <volumesnapshotcontent_name>
46+
----
47+
+
48+
. Optional: If the `VolumeSnapshot` object is not successfully deleted, enter the following command to remove any finalizers for the leftover resource so that the delete operation can continue:
49+
+
50+
[IMPORTANT]
51+
====
52+
Only remove the finalizers if you are confident that there are no existing references from either persistent volume claims or volume snapshot contents to the `VolumeSnapshot` object.
53+
Even with the `--force` option, the delete operation does not delete snapshot objects until all finalizers are removed.
54+
====
55+
+
56+
[source,terminal]
57+
----
58+
$ oc patch -n $PROJECT volumesnapshot/$NAME --type=merge -p '{"metadata": {"finalizers":null}}'
59+
----
60+
+
61+
.Example output
62+
[source, terminal]
63+
----
64+
volumesnapshotclass.snapshot.storage.k8s.io "csi-ocs-rbd-snapclass" deleted
65+
----
66+
+
67+
The finalizers are removed and the volume snapshot is deleted.

0 commit comments

Comments
 (0)