Skip to content

Commit

Permalink
rbd: add layering & deep flattenfeatures for groupsnapshot image
Browse files Browse the repository at this point in the history
Signed-off-by: Rakshith R <rar@redhat.com>
  • Loading branch information
Rakshith-R authored and mergify[bot] committed Dec 17, 2024
1 parent 09d848e commit 50b2a05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,10 @@ func flattenTemporaryClonedImages(ctx context.Context, rbdVol *rbdVolume, cr *ut
}
// If we start flattening all the snapshots at one shot the volume
// creation time will be affected,so we will flatten only the extra
// snapshots.
extraSnapshots := min(len(snaps)-int(minSnapshotsOnImageToStartFlatten), len(children))
// snapshots. Use the min of the extra snapshots and the number of children
// to avoid scenario where number of children are less than the extra snapshots.
// This occurs when the child images are in trash and not yet deleted.
extraSnapshots := min((len(snaps) - int(minSnapshotsOnImageToStartFlatten)), len(children))
children = children[:extraSnapshots]
err = flattenClonedRbdImages(
ctx,
Expand Down
4 changes: 4 additions & 0 deletions internal/rbd/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ func (rv *rbdVolume) NewSnapshotByID(
return nil, err
}

// set the features for the clone image.
f := []string{librbd.FeatureNameLayering, librbd.FeatureNameDeepFlatten}
rv.ImageFeatureSet = librbd.FeatureSetFromNames(f)

options, err := rv.constructImageOptions(ctx)
if err != nil {
return nil, err
Expand Down

0 comments on commit 50b2a05

Please sign in to comment.