Bug 1875558: Always delete found host from Ironic on deletion #96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we go to delete a node we look it up by either the UUID stored in
the Host or by name, but previously when we deleted it from Ironic we
only used the UUID from the Host. This meant if the Host UUID was empty
or didn't match, we would be stuck in a loop from which we could never
recover. We can't have it both ways; either a node found by name is the
one that matches and we should delete it, or it isn't and we should
report that the node cannot be found and thus the delete is complete.
It is not clear under what circumstances we end up in this state. It is
possible that it involves the node being discovered by Ironic before the
Host is created and then immediately deleted.
Treat a host matching by name as the one we are looking for, and delete
it regardless of whether we had already stored the node ID.
Fixes metal3-io#482
(cherry picked from commit ad79872)