-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RBD: Flatten group snapshot #4973
base: devel
Are you sure you want to change the base?
Conversation
/test ci/centos/mini-e2e-helm/k8s-1.31 |
/test ci/centos/mini-e2e-helm/k8s-1.31 |
5 additional group snapshots are created and deleted successfully. |
d22ce45
to
234ae0c
Compare
/test ci/centos/mini-e2e-helm/k8s-1.31 |
/retest ci/centos/mini-e2e-helm/k8s-1.31 |
E2E changes in this pr adds creation & deletion of additional volumegroupsnapshots.
|
4c35c58
to
8882254
Compare
/test ci/centos/mini-e2e-helm/k8s-1.31 |
8882254
to
43cf95f
Compare
/test ci/centos/mini-e2e-helm/k8s-1.31 |
43cf95f
to
5edecc9
Compare
/test ci/centos/mini-e2e-helm/k8s-1.31 |
1 similar comment
/test ci/centos/mini-e2e-helm/k8s-1.31 |
b41a344
to
94b9f0b
Compare
/test ci/centos/mini-e2e-helm/k8s-1.31 |
94b9f0b
to
771763a
Compare
/test ci/centos/mini-e2e-helm/k8s-1.31 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
c366113
to
9c17a49
Compare
Pull request has been modified.
// 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. | ||
snaps = snaps[minSnapshotsOnImageToStartFlatten-1:] | ||
// 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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recent changes addresses this edge case @iPraveenParihar pointed out.
Added comments to better explain the scenario as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits.
e2e/volumegroupsnapshot_base.go
Outdated
@@ -456,6 +456,22 @@ func (v *volumeGroupSnapshotterBase) testVolumeGroupSnapshot(vol VolumeGroupSnap | |||
return fmt.Errorf("failed to create volume group snapshot: %w", err) | |||
} | |||
|
|||
// Create and delete 5 additional group snapshots to test flattening on minSnapshotLimit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a generic base for both cephfs and rbd, IMO this either needs a separate case or needs adjusted where cephfs is not impacted because of this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed rbd specific comment.
I think creation & deletion of multiple volgroupsnap serves a good default test case for cephfs too.
creds, err := util.NewUserCredentials(req.GetSecrets()) | ||
if err != nil { | ||
return nil, status.Error(codes.Internal, err.Error()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer cr.DeleteCredentials()
is missing here?
internal/rbd/types/volume.go
Outdated
@@ -58,6 +58,10 @@ type Volume interface { | |||
// if the parent image is in trash, it returns an error. | |||
// if the parent image exists and is not enabled for mirroring, it returns an error. | |||
HandleParentImageExistence(ctx context.Context, flattenMode FlattenMode) error | |||
// PrepareVolumeForSnapshot prepares the volume for snapshot by | |||
// checking snapshots limit and clone depth limit and flattening it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flattening
to flatten
9c17a49
to
ff3d339
Compare
Pull request has been modified.
e2e/volumegroupsnapshot_base.go
Outdated
@@ -456,6 +456,22 @@ func (v *volumeGroupSnapshotterBase) testVolumeGroupSnapshot(vol VolumeGroupSnap | |||
return fmt.Errorf("failed to create volume group snapshot: %w", err) | |||
} | |||
|
|||
// Create and delete 5 additional group snapshots. | |||
for i := range 5 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have this as a configurable value in the base structure and set it only for RBD so that we don't run the test when it is not required.
ff3d339
to
095ccca
Compare
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit.
e2e/volumegroupsnapshot_base.go
Outdated
storageClassName string | ||
blockPVC bool | ||
totalPVCCount int | ||
additionalSnapshotCount int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionalSnapshotCount
to additionalVolumeGroupSnapshotCount
or additionalVGSnapshotCount
.
095ccca
to
aca7c22
Compare
LGTM!, @Rakshith-R, can you please address the golangci-lint failure? |
Signed-off-by: Rakshith R <[email protected]>
This commit consolidates flatten logic checks for cloneDepth and snapshotLimit in PrepareVolumeForSnapshot. This allows the function to be called for both CreateSnapshot and CreateVolumeGroupSnapshot. Clone Depth check and flattening of grand parent image now occurs before creation of snapshot starts. This aligns better with how PVC-PVC clone and PVC-restore process occurs currently. Flattening the grandparent image once prevents flattening of every newly created snapshot. Snapshot in above para refers to k8s VolumeSnapshot (which is backed by a rbd image). Signed-off-by: Rakshith R <[email protected]>
Currently, CephCSI only uses listSnaps to determine number of snapshots on a RBD image and uses snapshot names as child image names to flatten them. But child images may have different name(in case of group snapshot) or they maybe in trash (deleted k8s VolSnapshot with alive restored PVC). The above problems are avoid by making use of both snap and child image lists. Signed-off-by: Rakshith R <[email protected]>
Signed-off-by: Rakshith R <[email protected]>
This commit modifies code to pass volumeGroupSnapshotterBase by pointer to address the following linter error. ``` hugeParam: v is heavy (80 bytes); consider passing it by pointer (gocritic) func (v volumeGroupSnapshotterBase) CreateVolumeGroupSnapshotClass( ``` Signed-off-by: Rakshith R <[email protected]>
aca7c22
to
c420bf5
Compare
Pull request has been modified.
its fixed now, |
Describe what this PR does
Related issues
related-to: #5000
Fixes: #issue_number
Checklist:
guidelines in the developer
guide.
Request
notes
updated with breaking and/or notable changes for the next major release.
Show available bot commands
These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:
/retest ci/centos/<job-name>
: retest the<job-name>
after unrelatedfailure (please report the failure too!)