-
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?
Changes from 1 commit
3d5f06d
2bcdc34
9857641
8c99b2f
c420bf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
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]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2277,3 +2277,28 @@ func (ri *rbdImage) GetClusterID(ctx context.Context) (string, error) { | |||||
|
||||||
return ri.ClusterID, nil | ||||||
} | ||||||
|
||||||
func (rv *rbdVolume) PrepareVolumeForSnapshot(ctx context.Context, cr *util.Credentials) error { | ||||||
Madhu-1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
hardLimit := rbdHardMaxCloneDepth | ||||||
softLimit := rbdSoftMaxCloneDepth | ||||||
err := flattenTemporaryClonedImages(ctx, rv, cr) | ||||||
if err != nil { | ||||||
return err | ||||||
} | ||||||
|
||||||
// choosing 2, since snapshot adds one depth and we'll be flattening the parent. | ||||||
const depthToAvoidFlatten = 2 | ||||||
if rbdHardMaxCloneDepth > depthToAvoidFlatten { | ||||||
hardLimit = rbdHardMaxCloneDepth - depthToAvoidFlatten | ||||||
} | ||||||
if rbdSoftMaxCloneDepth > depthToAvoidFlatten { | ||||||
softLimit = rbdSoftMaxCloneDepth - depthToAvoidFlatten | ||||||
} | ||||||
|
||||||
err = rv.flattenParent(ctx, hardLimit, softLimit) | ||||||
if err != nil { | ||||||
return getGRPCErrorForCreateVolume(err) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why its returning GRPC error that to for CreateVolume? ideally internal functions are expected to return plain error message and the caller should pick the right GRPC message. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ceph-csi/internal/rbd/controllerserver.go Line 301 in a32ba13
It's used in the same form at multiple places. ceph-csi/internal/rbd/controllerserver.go Line 575 in a32ba13
Let's handle it separately |
||||||
} | ||||||
|
||||||
return nil | ||||||
} |
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?