ceph / ceph/ceph-csi

rbd: CephCSI cannot determine correct clone depth in certain case

Open
#4,013 16 comments 0 reactions 1 assignee Claimed by @nixpanic View on GitHub
bug component/rbd dependency/go-ceph keepalive
Dominant language
Go
Stars
1.6k
Forks
617
Avg merge
5d 10h
Merged PRs (30d)
43

Description

# Describe the bug #

If parent PVC of snapshot/ restore/clone pvc is deleted,
then
https://github.com/ceph/ceph-csi/blob/35eb347eaccfc8875b1c4e2073f557c008f5e656/internal/rbd/rbd_util.go#L700
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 https://github.com/rook/rook/issues/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` or `kernel`. for rbd its
`krbd` or `rbd-nbd`) : krbd
- Kubernetes cluster version : all
- Ceph cluster version : all

# Steps to reproduce #

Steps to reproduce the behavior:

1. Create a chain of clones/ snapshot+restores
2. Delete parent snapshot/clone immediately after child pvc/snapshot creation
3. 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.