rbd: set depthToAvoidFlatten to 3 during PVC-PVC clone

During PVC-PVC clone creation, parent of the datasource
image is flattened after checking for clone depth.
We need to account for data source image as well since
we're calculating depth from the parent image.
depthToAvoidFlatten = 3(datasource image + temp + final clone)

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2024-11-14 14:15:16 +05:30 committed by mergify[bot]
parent eea64fe1f9
commit d457840d21

View File

@ -461,9 +461,9 @@ func flattenParentImage(
hardLimit := rbdHardMaxCloneDepth
softLimit := rbdSoftMaxCloneDepth
if rbdVol != nil {
// choosing 2, since cloning image creates a temp clone and a final clone which
// will add a total depth of 2.
const depthToAvoidFlatten = 2
// choosing 3, since cloning image creates a temp clone and a final clone which
// will add a total depth of 2 and the parent image itself adds one depth.
const depthToAvoidFlatten = 3
if rbdHardMaxCloneDepth > depthToAvoidFlatten {
hardLimit = rbdHardMaxCloneDepth - depthToAvoidFlatten
}