-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix issue #2391 When clone dv from an existing pvc use smart clone, s… #2397
fix issue #2391 When clone dv from an existing pvc use smart clone, s… #2397
Conversation
…ome ann of dv can't be inherited by the new pvc. Signed-off-by: zhuanlan <zhuanlan_yewu@cmss.chinamobile.com>
Hi @Longchuanzheng. 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. |
/test all |
Your code is fine, we have a very similar process for other DVs and it seems the smart clone case just slipped through the cracks. I do ask that you add or modify a functional test to verify the annotations are properly passed to the PVC. For example this test you could modify it to look something like this: dataVolume, err = utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dataVolume)
Expect(err).ToNot(HaveOccurred())
// Set annotation on DV which we can verify on PVC later
dataVolume.GetAnnotations()["test"] = "test-value"
f.ExpectEvent(dataVolume.Namespace).Should(ContainSubstring(controller.SmartCloneSourceInUse))
err = f.K8sClient.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{})
Expect(err).ToNot(HaveOccurred())
f.ExpectEvent(dataVolume.Namespace).Should(ContainSubstring(controller.SnapshotForSmartCloneInProgress))
f.ExpectEvent(dataVolume.Namespace).Should(ContainSubstring(controller.SmartClonePVCInProgress))
// Wait for operation Succeeded
waitForDvPhase(cdiv1.Succeeded, dataVolume, f)
f.ExpectEvent(dataVolume.Namespace).Should(ContainSubstring(controller.CloneSucceeded))
// Verify PVC's content
verifyPVC(dataVolume, f, utils.DefaultImagePath, utils.UploadFileMD5)
targetPvc, err := f.K8sClient.CoreV1().PersistentVolumeClaims(dataVolume.Namespace).Get(context.TODO(), dataVolume.Name, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
Expect(targetPvc.GetAnnotations()["test"]).To(Equal("test-value")) That way you have verified that the smart clone annotations are being transferred properly. Maybe use some constants, I just wrote this while I was typing. |
…e properly passed to the PVC Signed-off-by: zhuanlan <zhuanlan_yewu@cmss.chinamobile.com>
thank you for your instance, I modify the pkg/controller/smart-clone-controller_test.go test: Should create PVC if snapshot ready. I have tested this modify can detect whether the pvc get anns from the dv. |
/test all |
/retest |
@Longchuanzheng: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/test pull-containerized-data-importer-e2e-upg |
/lgtm |
[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 |
…ome ann of dv can't be inherited by the new pvc.
Signed-off-by: zhuanlan zhuanlan_yewu@cmss.chinamobile.com
What this PR does / why we need it:
fix issue#2391: When clone dv from an existing pvc use smart clone, some ann of dv can't be inherited by the new pvc. #2391
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2391
Special notes for your reviewer:
Although my code works, but I think these code may not meet the logic of reconcile and need to be improved.
Release note: