-
Notifications
You must be signed in to change notification settings - Fork 319
Handle re-registration in all states #716
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6843481
Create NeedsRegistration error
zaneb 3ea268e
Separate Adopt() and ValidateManagementAccess()
zaneb b7b10d7
Ensure registration in every state
zaneb 93cbf64
Refactor HostStateMachine.handleDeprovisioning()
zaneb 502d2fb
Move checksum method to Image
zaneb 2e4e00b
Use provisioned image data for adoption
zaneb 1846513
ironic: Don't do automated cleaning twice in a row
zaneb 1f17aab
Adopt node after re-registration during deprovisioning
zaneb 79f695d
Deprovision Node during deletion whenever possible
zaneb 324f7b1
Retry when adoption fails
zaneb 431470c
Clear maintenance flag in CleanFail
zaneb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -560,7 +560,7 @@ func (p *ironicProvisioner) InspectHardware() (result provisioner.Result, detail | |
| return | ||
| } | ||
| if ironicNode == nil { | ||
| return result, nil, fmt.Errorf("no ironic node for host") | ||
| return result, nil, provisioner.NeedsRegistration | ||
| } | ||
|
|
||
| status, err := introspection.GetIntrospectionStatus(p.inspector, ironicNode.UUID).Extract() | ||
|
|
@@ -650,7 +650,7 @@ func (p *ironicProvisioner) UpdateHardwareState() (result provisioner.Result, er | |
| return result, errors.Wrap(err, "failed to find existing host") | ||
| } | ||
| if ironicNode == nil { | ||
| return result, fmt.Errorf("no ironic node for host") | ||
| return result, provisioner.NeedsRegistration | ||
| } | ||
|
|
||
| var discoveredVal bool | ||
|
|
@@ -1000,18 +1000,12 @@ func (p *ironicProvisioner) Adopt() (result provisioner.Result, err error) { | |
| return | ||
| } | ||
| if ironicNode == nil { | ||
| // The node does not exist, but we were called so the | ||
| // controller thinks that the node existed at one time. That | ||
| // likely means data loss from restarting the database, so | ||
| // pass through the validation process to register the node | ||
| // again. Pass true to indicate that we need to re-test the | ||
| // credentials, just in case. | ||
| p.log.Info("re-registering host") | ||
| return p.ValidateManagementAccess(true) | ||
| err = provisioner.NeedsRegistration | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A log trace could be useful here
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Returning an error all the way up through Reconcile() (which this does) always results in a log trace. |
||
| return | ||
| } | ||
|
|
||
| switch nodes.ProvisionState(ironicNode.ProvisionState) { | ||
| case nodes.Enroll: | ||
| case nodes.Enroll, nodes.Verifying: | ||
| err = fmt.Errorf("Invalid state for adopt: %s", | ||
| ironicNode.ProvisionState) | ||
| case nodes.Manageable: | ||
|
|
@@ -1021,7 +1015,7 @@ func (p *ironicProvisioner) Adopt() (result provisioner.Result, err error) { | |
| Target: nodes.TargetAdopt, | ||
| }, | ||
| ) | ||
| case nodes.Adopting, nodes.Verifying: | ||
| case nodes.Adopting: | ||
| result.RequeueAfter = provisionRequeueDelay | ||
| result.Dirty = true | ||
| case nodes.AdoptFail: | ||
|
|
@@ -1043,7 +1037,7 @@ func (p *ironicProvisioner) Provision(hostConf provisioner.HostConfigData) (resu | |
| return result, errors.Wrap(err, "could not find host to receive image") | ||
| } | ||
| if ironicNode == nil { | ||
| return result, fmt.Errorf("no ironic node for host") | ||
| return result, provisioner.NeedsRegistration | ||
| } | ||
|
|
||
| p.log.Info("provisioning image to host", "state", ironicNode.ProvisionState) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 would probably go ahead and remove this method, but that's not a reason to hold up this PR.