Description
Describe the bug
If parent PVC of snapshot/ restore/clone pvc is deleted,
then
ceph-csi/internal/rbd/rbd_util.go
Line 700 in 35eb347
will not work as intended.
Therefore, the clone depth returned is not correct since this function requires all parent images in chain to be present in cluster(deleted parent images will be trash).
One side affect is the issue described here rook/rook#12312.
Creating a chain of clone/snapshot+restore and deleting parent snapshot and PVC renders the final child PVC
to be unmountable.
Environment details
- Image/version of Ceph CSI driver : All supported cephcsi versions.
- Helm chart version : -
- Kernel version : -
- Mounter used for mounting PVC (for cephFS its
fuse
orkernel
. for rbd its
krbd
orrbd-nbd
) : krbd - Kubernetes cluster version : all
- Ceph cluster version : all
Steps to reproduce
Steps to reproduce the behavior:
- Create a chain of clones/ snapshot+restores
- Delete parent snapshot/clone immediately after child pvc/snapshot creation
- Try to mount child PVC to a pod.
Actual results
rbd map fails with the below error:
E0531 18:09:09.891563 15892 utils.go:210] ID: 198 Req-ID: 0001-0009-rook-ceph-0000000000000001-8b978541-8495-4c20-bcab-0a42fa927b5a GRPC error: rpc error: code = Internal desc = rbd: map failed with error an error (exit status 22) occurred while running rbd args: [--id csi-rbd-node -m 10.110.0.127:6789,10.109.223.145:6789,10.108.43.136:6789 --keyfile=***stripped*** map replicapool/csi-vol-8b978541-8495-4c20-bcab-0a42fa927b5a --device-type krbd --options noudev], rbd error output: rbd: sysfs write failed rbd: map failed: (22) Invalid argument
Expected behavior
No error.
Workaround
Flatten the child PVC image manually.
Possible Solution
From CephCSI point of view, we have no other to determine clone depth.
We need a API change possibly in rbd image info providing us with clone depth from ceph.
cc @ceph/ceph-csi-contributors