Skip to content
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

csi: Return error when deleting node #9803

Merged
merged 2 commits into from
Jan 14, 2021
Merged

csi: Return error when deleting node #9803

merged 2 commits into from
Jan 14, 2021

Conversation

krishicks
Copy link
Contributor

@krishicks krishicks commented Jan 13, 2021

The error that this would have returned would only have been returned if
the lookup in a map did not fail and the value that the map returned was
nil, which I think is not possible the map keys are pointers, so they can be!

In this change we'll properly return the error in the
CSIPluginTypeMonolith case (which is the type given in DeleteNode()),
and also actually return the error when the given ID is not found.

This was found via errcheck.

Note: Since I don't think it was possible for this to have ever actually returned an error before, I wonder if the behavior when trying to delete a node where one of the controller or node is not found should actually return an error, and if so, if it should only do so for one and not the other. In other words, if you want to delete a node and there's no controller found, should it still proceed to try deleting the node from the map?

The error that this would have returned would only have been returned if
the lookup in a map did not fail and the value that the map returned was
nil, which I think is not possible.

In this change we'll properly return the error in the
CSIPluginTypeMonolith case (which is the type given in DeleteNode()),
and also actually return the error when the given ID is not found.

This was found via errcheck.
nomad/structs/csi.go Show resolved Hide resolved
nomad/structs/csi.go Outdated Show resolved Hide resolved
These tests were backfilled and run against the original implementation
before the updated implementation was restored and modified to fix the
prev == nil check.

Additional behavior was added to return a multierror in the case of
CSIPluginTypeMonolith, with associated tests added, too.
@vercel vercel bot temporarily deployed to Preview – nomad-storybook-and-ui January 13, 2021 20:05 Inactive
@vercel vercel bot temporarily deployed to Preview – nomad January 13, 2021 20:05 Inactive
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@krishicks krishicks merged commit 35f831c into master Jan 14, 2021
@krishicks krishicks deleted the hicks/errcheck-csi branch January 14, 2021 20:44
backspace pushed a commit that referenced this pull request Jan 22, 2021
In this change we'll properly return the error in the
CSIPluginTypeMonolith case (which is the type given in DeleteNode()),
and also return the error when the given ID is not found.

This was found via errcheck.
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants