-
Notifications
You must be signed in to change notification settings - Fork 559
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 datasource image before creating volume #2900
Conversation
/retest all |
d3c7ee0
to
5a01cfe
Compare
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.
@Rakshith-R have you tested this with hardlimit and softlimit of 1
?
internal/rbd/controllerserver.go
Outdated
hardLimit := rbdHardMaxCloneDepth | ||
softLimit := rbdSoftMaxCloneDepth |
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.
declare this outside of if statements as its common for both snapshot and volume
@@ -335,6 +359,29 @@ func flattenParentImage(ctx context.Context, rbdVol *rbdVolume, cr *util.Credent | |||
return err | |||
} | |||
} | |||
if rbdSnap != nil { | |||
err := rbdSnap.Connect(cr) |
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.
where defer Destroy is called for this one?
internal/rbd/controllerserver.go
Outdated
if rbdSnap != nil { | ||
err := rbdSnap.Connect(cr) | ||
if err != nil { | ||
return err |
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.
need to return grpc error?
5a01cfe
to
265e59a
Compare
const depthToAvoidFlatten = 2 #1 for snapshot
if rbdHardMaxCloneDepth > depthToAvoidFlatten {
hardLimit = rbdHardMaxCloneDepth - depthToAvoidFlatten
}
if rbdSoftMaxCloneDepth > depthToAvoidFlatten {
softLimit = rbdSoftMaxCloneDepth - depthToAvoidFlatten
}
|
@Mergifyio rebase |
✅ Branch has been successfully rebased |
265e59a
to
13e99e4
Compare
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.
changes LGTM can you please set max limit RbdHardMaxCloneDepth
to 2 here https://github.com/ceph/ceph-csi/blob/devel/scripts/install-helm.sh#L182 to test no stale are left behind?
internal/rbd/rbd_util.go
Outdated
|
||
// flattenParentImage flatten the given image's parent if it exists according to hard and soft | ||
// limits. | ||
func (ri *rbdImage) flattenParentImage(ctx context.Context, hardLimit, softLimit uint) 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.
we already have flattenParentImage
image in controllerserver. rename this to flattenParent?
13e99e4
to
145951f
Compare
@Madhu-1 , Due to #2327 , setting this lower depth will leave stale images. |
/retest all |
@Mergifyio rebase |
✅ Branch has been successfully rebased |
145951f
to
1668c68
Compare
Asked to make sure in any case there wont be any stale resources left behind |
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, small nit
@Mergifyio rebase |
✅ Branch has been successfully rebased |
75fe110
to
1f1663a
Compare
✅ Pull request refreshed |
/retest ci/centos/mini-e2e/k8s-1.21 |
@Rakshith-R "ci/centos/mini-e2e/k8s-1.21" test failed. Logs are available at location for debugging |
@Mergifyio refresh |
@github-actions[bot] is not allowed to run commands |
/retest ci/centos/upgrade-tests-rbd |
/retest ci/centos/k8s-e2e-external-storage/1.23 |
success status was not reflected back to github |
@Mergifyio rebase |
This commit ensures that parent image is flattened before creating volume. - If the data source is a PVC, the underlying image's parent is flattened(which would be a temp clone or snapshot). hard & soft limit is reduced by 2 to account for depth that will be added by temp & final clone. - If the data source is a Snapshot, the underlying image is itself flattened. hard & soft limit is reduced by 1 to account for depth that will be added by the clone which will be restored from the snapshot. Flattening step for resulting PVC image restored from snapshot is removed. Flattening step for temp clone & final image is removed when pvc clone is being created. Fixes: ceph#2190 Signed-off-by: Rakshith R <[email protected]>
✅ Branch has been successfully rebased |
1f1663a
to
0000b26
Compare
/retest ci/centos/k8s-e2e-external-storage/1.22 |
@Rakshith-R "ci/centos/k8s-e2e-external-storage/1.22" test failed. Logs are available at location for debugging |
@Mergifyio refresh |
✅ Pull request refreshed |
/retest ci/centos/mini-e2e/k8s-1.22 |
@Rakshith-R "ci/centos/mini-e2e/k8s-1.22" test failed. Logs are available at location for debugging |
@Mergifyio refresh |
✅ Pull request refreshed |
CephCSI should not flatten image that can be mounted for use by the user. `checkFlatten()` was called in a recovery code flow of PVC restored from snapshot and was missed while refractoring in ceph#2900 refer: ceph#2900 Signed-off-by: Rakshith R <[email protected]>
CephCSI should not flatten image that can be mounted for use by the user. `checkFlatten()` was called in a recovery code flow of PVC restored from snapshot and was missed while refractoring in ceph#2900 refer: ceph#2900 Signed-off-by: Rakshith R <[email protected]>
CephCSI should not flatten image that can be mounted for use by the user. `checkFlatten()` was called in a recovery code flow of PVC restored from snapshot and was missed while refractoring in ceph#2900 refer: ceph#2900 Signed-off-by: Rakshith R <[email protected]>
CephCSI should not flatten image that can be mounted for use by the user. `checkFlatten()` was called in a recovery code flow of PVC restored from snapshot and was missed while refractoring in #2900 refer: #2900 Signed-off-by: Rakshith R <[email protected]>
This commit encures that parent image is flattened before
creating volume.
If the data source is a PVC, the underlying image's parent
is flattened(which would be a temp clone or snapshot).
hard & soft limit is reduced by 2 to account for depth that
will be added by temp & final clone.
If the data source is a Snapshot, the underlying image is
itself flattened.
hard & soft limit is reduced by 1 to account for depth that
will be added by the clone which will be restored from the
snapshot.
Flattening of resulting PVC image restored from snapshot is removed.
Flattening step for temp clone & final image is removed when pvc clone is
being created.
Fixes: #2190
Signed-off-by: Rakshith R [email protected]