# Error message on Deleting an image with snapshot is misleading # ``` sh-4.2# rbd trash ls --pool=ocs-storagecluster-cephblockpool 375a127ca368 csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031 ``` Image deletion fails with error: ``` sh-4.2# rbd trash rm 375a127ca368 --pool=ocs-storagecluster-cephblockpool 2021-05-07 08:49:43.400 7fab937fe700 -1 librbd::SnapshotRemoveRequest: 0x7fab84008d00 should_complete: encountered error: (16) Device or resource busy 2021-05-07 08:49:43.400 7fab937fe700 -1 librbd::image::PreRemoveRequest: 0x7fab8c004540 handle_remove_snapshot: failed to auto-prune snapshot 4: (16) Device or resource busy 2021-05-07 08:49:43.404 7fabbe1f0b00 -1 librbd::api::Trash: remove: error removing image 375a127ca368, which is pending deletion rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed. Removing image: 0% complete...failed. ``` ``` sh-4.2# ceph progress Removing image ocs-storagecluster-cephblockpool/375a127ca368 from trash [............................] ``` But from CSI side, This is how Create Snapshot operation works : ``` Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d GRPC call: /csi.v1.Controller/CreateSnapshot I0507 08:47:39.130600 1 utils.go:160] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d GRPC request: {"name":"snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d","parameters":{"clusterID":"openshift-storage"},"secrets":"***stripped***","source_volume_id":"0001-0011-openshift-storage-0000000000000001-ad14b383-af0c-11eb-9c40-0a580a830031"} I0507 08:47:39.131737 1 omap.go:84] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d got omap values: (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.volume.ad14b383-af0c-11eb-9c40-0a580a830031"): map[csi.imageid:375a127ca368 csi.imagename:csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031 csi.volname:pvc-60aafee1-b476-47d9-a05e-ca3124e79a05] E0507 08:47:39.149383 1 omap.go:77] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d omap not found (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.snaps.default"): rados: ret=-2, No such file or directory I0507 08:47:39.220470 1 cephcmds.go:59] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d command succeeded: rbd [-m 172.30.136.38:6789,172.30.22.110:6789,172.30.153.49:6789 --id csi-rbd-provisioner --keyfile=***stripped*** -c /etc/ceph/ceph.conf --format=json snap ls --all ocs-storagecluster-cephblockpool/csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031] I0507 08:47:39.232555 1 omap.go:148] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d set omap keys (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.snaps.default"): map[csi.snap.snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d:e0e26db8-af10-11eb-9c40-0a580a830031]) I0507 08:47:39.235936 1 omap.go:148] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d set omap keys (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.snap.e0e26db8-af10-11eb-9c40-0a580a830031"): map[csi.imagename:csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 csi.snapname:snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d csi.source:csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031]) I0507 08:47:39.235953 1 rbd_journal.go:365] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d generated Volume ID (0001-0011-openshift-storage-0000000000000001-e0e26db8-af10-11eb-9c40-0a580a830031) and image name (csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031) for request name (snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d) I0507 08:47:39.235990 1 rbd_util.go:829] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d rbd: snap create ocs-storagecluster-cephblockpool/csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031@csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 using mon 172.30.136.38:6789,172.30.22.110:6789,172.30.153.49:6789 I0507 08:47:39.323973 1 rbd_util.go:875] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d rbd: clone ocs-storagecluster-cephblockpool/csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031@csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 (features: [deep-flatten layering]) using mon 172.30.136.38:6789,172.30.22.110:6789,172.30.153.49:6789 I0507 08:47:39.378012 1 rbd_util.go:841] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d rbd: snap rm ocs-storagecluster-cephblockpool/csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031@csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 using mon 172.30.136.38:6789,172.30.22.110:6789,172.30.153.49:6789 I0507 08:47:39.427040 1 rbd_util.go:829] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d rbd: snap create ocs-storagecluster-cephblockpool/csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031@csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 using mon 172.30.136.38:6789,172.30.22.110:6789,172.30.153.49:6789 I0507 08:47:40.420300 1 omap.go:148] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d set omap keys (pool="ocs-storagecluster-cephblockpool", namespace="", name="csi.snap.e0e26db8-af10-11eb-9c40-0a580a830031"): map[csi.imageid:375ab4e3b9e9]) I0507 08:47:40.464470 1 rbd_util.go:452] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d clone depth is (1), configured softlimit (4) and hardlimit (8) for ocs-storagecluster-cephblockpool/csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 I0507 08:47:40.465284 1 utils.go:165] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d GRPC response: {"snapshot":{"creation_time":{"nanos":346643250,"seconds":1620377259},"ready_to_use":true,"size_bytes":1073741824,"snapshot_id":"0001-0011-openshift-storage-0000000000000001-e0e26db8-af10-11eb-9c40-0a580a830031","source_volume_id":"0001-0011-openshift-storage-0000000000000001-ad14b383-af0c-11eb-9c40-0a580a830031"}} ``` As we can see above, the image does not have any snapshots as the snapshot of this parent image is deleted here: ``` 1 rbd_util.go:841] ID: 68 Req-ID: snapshot-a02983de-5c71-41b9-b983-34d43ab73c4d rbd: snap rm ocs-storagecluster-cephblockpool/csi-vol-ad14b383-af0c-11eb-9c40-0a580a830031@csi-snap-e0e26db8-af10-11eb-9c40-0a580a830031 using mon 172.30.136.38:6789,172.30.22.110:6789,172.30.153.49:6789 ``` Thus the error message `rbd: image has snapshots` is misleading as the image does not have any snapshots; it just has a clone with a snapshot.