From d457840d2183df5e94b2a554a068cfcec6e5796b Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Thu, 14 Nov 2024 14:15:16 +0530 Subject: [PATCH] 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 --- internal/rbd/controllerserver.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 5a4990410..3ec067c3e 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -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 }