Return VolumeSnapshotContent from various functions instead of nil#527
Conversation
ae12aef to
f7ed895
Compare
|
@jsafrane I have fixed the issue you mentioned with This seems to lower the "object has been modified" count a bit, but it's still not consistently low yet. Either way, I think this is probably heading the right direction. |
|
It's a step in the right direction. Every time the sidecar issues
And please check all error paths for returning |
|
Ok, I plan to update this PR soon with the above feedback. |
f7ed895 to
bc01c49
Compare
bc01c49 to
d3aa290
Compare
d3aa290 to
55b7f3a
Compare
796376e to
1f4c62d
Compare
|
@jsafrane ready for re-review, I've addressed your comments above. I've also done the following:
I still see around the same number "object has been modified" error count in our PR tests, but I think these changes are good to do regardless. |
|
@ggriffiths are you saying we don't see the "object has been modified" count getting reduced at all with changes in this PR? |
|
@xing-yang I wrote that comment before the final build ran. Up until then, the error count seemed to not be lowered after each commit. However, with the most recent commit, it seems to be lowered: 1.18 - 10 occurrences of object has been modified - link |
| if isCSIFinalError(err) { | ||
| if removeAnnotationErr := ctrl.removeAnnVolumeSnapshotBeingCreated(content); removeAnnotationErr != nil { | ||
| return nil, fmt.Errorf("failed to remove VolumeSnapshotBeingCreated annotation from the content %s: %s", content.Name, removeAnnotationErr) | ||
| if content, removeAnnotationErr := ctrl.removeAnnVolumeSnapshotBeingCreated(content); removeAnnotationErr != nil { |
There was a problem hiding this comment.
This declares a new variable content, shadowing the existing one. return at line 310 below therefore returns the old content.
With following code, I don't see any "the object has been modified":
var removeAnnotationErr error
if content, removeAnnotationErr = ctrl.removeAnnVolumeSnapshotBeingCreated(...)
There was a problem hiding this comment.
good catch, let me address this
|
I found one issue in the PR, but the rest looks good to me and it reduces nr. of conflicts, at least in my test case (taking snapshot of a non-existing CSI hostpath volume - the driver constantly returns |
Signed-off-by: Grant Griffiths <ggriffiths@purestorage.com>
1f4c62d to
5cf92fc
Compare
|
/lgtm |
|
/assign @xing-yang |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ggriffiths, jsafrane The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Grant Griffiths ggriffiths@purestorage.com
What type of PR is this?
/kind bug
What this PR does / why we need it:
When removeAnnVolumeSnapshotBeingCreated fails, updatedContent is not returned.
Which issue(s) this PR fixes:
Part of #525
Special notes for your reviewer:
This does not completely fix the problem, but it does seem to lower the count.
Does this PR introduce a user-facing change?: