ceph / ceph/ceph-csi

cleanup: rework approach to traverse rbd image chain

Open
#2,144 4 comments 0 reactions 0 assignees View on GitHub
cleanup component/rbd keepalive priority-1
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.