Skip to content

Commit

Permalink
rbd: flattern image when it has references to parent
Browse files Browse the repository at this point in the history
Currently as part of node service we add rbd flatten task for new PVC
creates. Ideally we should add flatten task only for snapshots/cloned
PVCs as required.

Fixes: ceph#1543
Signed-off-by: Prasanna Kumar Kalever <[email protected]>
  • Loading branch information
Prasanna Kumar Kalever authored and mergify-bot committed Oct 20, 2020
1 parent 9dee064 commit 4eeac9b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/rbd/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -273,7 +274,13 @@ 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
Expand Down

0 comments on commit 4eeac9b

Please sign in to comment.