rbd: flatten image if the depth is not zero

flatten the image if the deep-flatten feature
is present on the images in the chain or if the
images in chain is not zero, as we cannot check
the deep-flatten feature the images which are
in trash.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-05-03 16:32:40 +05:30 committed by mergify[bot]
parent e15e2e5081
commit 67d73cd6e9

View File

@ -238,6 +238,7 @@ func (ns *NodeServer) stageTransaction(ctx context.Context, req *csi.NodeStageVo
var err error
var readOnly bool
var feature bool
var depth uint
var cr *util.Credentials
cr, err = util.NewUserCredentials(req.GetSecrets())
@ -272,7 +273,11 @@ func (ns *NodeServer) stageTransaction(ctx context.Context, req *csi.NodeStageVo
if err != nil {
return transaction, err
}
if feature {
depth, err = volOptions.getCloneDepth(ctx)
if err != nil {
return transaction, err
}
if feature || depth != 0 {
err = volOptions.flattenRbdImage(ctx, cr, true, rbdHardMaxCloneDepth, rbdSoftMaxCloneDepth)
if err != nil {
return transaction, err