-
Notifications
You must be signed in to change notification settings - Fork 295
DV Recreated with Wrong Status #3912
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
Conversation
its status from a PVC that is marked for deletion Signed-off-by: dsanatar <[email protected]>
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.
Good catch! Testing this would be great but seems tricky to do.
/lgtm
I think we should be able to supply the erroneous state to a fake reconciler in a unit test, tbh, that would also make me feel a little better about this change as I don't completely understand the scenario |
Agree but isolating this logic might not be straightforward, and also there're no utests for this file. The behavior is racy but maybe it's worth having a functest that deletes the pvc and ensures the DV completes nicely to ensure there're no weird behaviors in between? |
|
/hold |
That's prone to flakes, I'd unit test it with a pinpointed state identified to be wrong |
86dc206 to
c8f800b
Compare
|
/unhold |
| // Reset the DV status phase | ||
| newPhase := cdiv1.Pending | ||
| dv.Status.Phase = newPhase | ||
| err = reconciler.client.Status().Update(context.TODO(), dv) | ||
| Expect(err).ToNot(HaveOccurred()) |
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.
Which entity would be causing this in a "real" setup?
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 problem spawns from when a deleted DV from a VM's DVTemplate is recreated. Here I am trying to emulate that behavior of the "new" DV by just resetting the status and making sure it doesn't inherit a new status from it's associated PVC that is in the process of deletion.
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 see, maybe we can reduce the test to that then? IOW are all the setup steps really needed?
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.
Yea good point, I can give that a go and see.
c8f800b to
d35c0f7
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.
I believe you can further reduce this to passing the entire state to the fake reconciler, but up to you
/approve
| // Set finalizer so PVC is not removed when Delete is called | ||
| pvc.Finalizers = append(pvc.Finalizers, "test-finalizer") | ||
| err = reconciler.client.Update(context.TODO(), pvc) | ||
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
| // Mark PVC for deletion | ||
| err = reconciler.client.Delete(context.TODO(), pvc) | ||
| Expect(err).ToNot(HaveOccurred()) |
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.
You don't have to use the client to setup the state, you can just pass the objects in the target state to createImportReconciler
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: akalenyu 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 |
update the status of existing DVs Signed-off-by: dsanatar <[email protected]>
d35c0f7 to
b39fb7d
Compare
|
/lgtm |
What this PR does / why we need it:
When a DV that is apart of a VM's DVTemplate gets deleted occasionally during the recreation, the new DV will be seen to immediately have status of Succeeded with Progress at 100% and then will eventually switch back to Pending. This is due to a race condition where the associated PVC is not deleted/cleaned up in time for when the new DV goes to update its status. Since the new DV will see the old PVC is bound, it will immediately update it's first status to Succeeded.
Added a new check during
updateStatus()to prevent DVs from using PVCs that have aDeletionTimeStampRelease note: