cleanup: rework approach to traverse rbd image chain
- Dominant language
- Go
- Stars
- 1.6k
- Forks
- 617
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 43
Description
In current approach for iteration of chained images in functions like [getCloneDepth()](https://github.com/ceph/ceph-csi/blob/devel/internal/rbd/rbd_util.go#L530) and [checkImageChainHasFeature()](https://github.com/ceph/ceph-csi/blob/devel/internal/rbd/rbd_util.go#L701),
we re-use and update an rbdVolume with different attributes which is quite wrong.
https://github.com/ceph/ceph-csi/blob/7b5c78ec7c36b98433d19956efba2bf061dc3428/internal/rbd/rbd_util.go#L563
Rework the loop such that:
we create and destroy a new volume inside the loop and use it for iteration and not just change parameters of the existing volume.
With this, we might be able to reduce complexity and it will minimize the redundant code in both functions.
See https://github.com/ceph/ceph-csi/pull/1838#discussion_r598530807
cc @nixpanic
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.