-
Notifications
You must be signed in to change notification settings - Fork 242
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
Make size optional when cloning using the Storage API #2222
Make size optional when cloning using the Storage API #2222
Conversation
Hi @alromeros. Thanks for your PR. I'm waiting for a kubevirt member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
When you create a commit make sure to add |
3f2ffdc
to
0f25b40
Compare
/ok-to-test |
// When cloning a PVC, if the target's size is not specified, | ||
// said value can be attainable from the source PVC | ||
if selectedCloneStrategy != NoClone { | ||
targetRequest, hasTargetRequest := pvcSpec.Resources.Requests[corev1.ResourceStorage] |
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.
if I understand correctly at this point hasTargetRequest can't be false right? maybe return an error if somehow it is?
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.
Yes, It shouldn't be, but I wanted to make sure. I'll later add proper error handling, thanks!
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.
over all looks good! had some questions. great job!
Very good direction. |
f2c09fb
to
02c6215
Compare
1f8cd07
to
d556888
Compare
Signed-off-by: Alvaro Romero <alromero@redhat.com>
…etection pod This commit introduces additional handling in case of error after and during the size-detection pod is created. It also updates several related unit tests. Signed-off-by: Alvaro Romero <alromero@redhat.com>
d556888
to
19c4ba4
Compare
/retest |
/test pull-containerized-data-importer-e2e-hpp-latest |
good, I cannot find the new test but I think it is ready to go But it is a big PR so it would be good to have another reviewer do the last check. |
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.
I think that in detectCloneSize, the branch when source is block needs additional logic
targetSize, err = inflateSizeWithOverhead(r.client, imgSize, pvcSpec)
@@ -916,6 +975,40 @@ func cloneStrategyToCloneType(selectedCloneStrategy cloneStrategy) string { | |||
return "" | |||
} | |||
|
|||
// reconcileSizelessClone handles the reconciling process if the size-detection mechanism is not able to obtain the img size | |||
func (r *DatavolumeReconciler) reconcileSizelessClone( |
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.
When seeing this function this was screaming, use me in all 3 variations.
The csi clone, the snapshot clone, and the no target size clone. I would call it something like isSourceReadyToClone
that returns a boolean and error. The error is to catch the normal errors like now. When calling this function I would do it something like this for the csi clone and smart clone options.
if readyToClone, err := r.isSourceReadyToClone(dv, cloneStrategy); err != nil {
return reconcile.Result{}, err
} else if !readyToClone {
return reconcile.Result{Requeue: true},
r.updateCloneStatusPhase(cdiv1.CloneScheduled, datavolume, nil, selectedCloneStrategy)
}
For the size less clone option something like this
else if !done {
if readyToClone, err := r.isSourceReadyToClone(dv, cloneStrategy); err != nil {
return reconcile.Result{}, err
} else if !readyToClone {
return reconcile.Result{Requeue: true},
r.updateCloneStatusPhase(cdiv1.CloneScheduled, datavolume, nil, cloneStrategy)
}
return reconcile.Result{}, nil
}
Expect(sourceMD5).To(Equal(targetMD5)) | ||
}, | ||
Entry("Block to block (empty storage size)", v1.PersistentVolumeBlock, v1.PersistentVolumeBlock), | ||
Entry("Block to filesystem (empty storage size)", v1.PersistentVolumeBlock, v1.PersistentVolumeFilesystem), |
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.
So if you are skipping due to that bug, I would remove the manual skip code above and make this a PEntry (which will skip the entry).
…y storage size * Modified the size-detection mechanism so we account for fsOverhead when cloning to filesystem volume mode in all cases * Clean up the code for reconciling when cloning a PVC that is not ready * Minor fix in functional test so it works when cloning from block to filesystem volume mode Signed-off-by: Alvaro Romero <alromero@redhat.com>
/test pull-containerized-data-importer-e2e-ceph |
/lgtm |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awels The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
When cloning a Data Volume, the size of the target can be potentially obtainable via the source PVC. This discards the need to explicitly specify it.
Considering that, this PR aims to modify the cloning process in order to allow omitting the
resources.request.storage
field when cloning a PVC, which will be obtained from the source instead.Special notes for your reviewer:
Release note: