-
Notifications
You must be signed in to change notification settings - Fork 241
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
ensure the boot mode is set in ironic before starting inspection #635
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dhellmann 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 |
/test-integration |
/test-integration |
// it needs error handling logic that we can't support in | ||
// this function. | ||
if updateBootModeStatus(hsm.Host) { | ||
info.log.Info("saving boot mode") |
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.
Not that we have to fix it in this PR, but this log output would potentially be more useful if it included the bootMode that we saved?
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.
Sure, that makes sense. Done.
lgtm but needs a rebase |
709b641
to
5e503bb
Compare
Rebased |
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Move the call to update the boot mode in the status fields to one spot in the state machine where we always know the new state we're going to transition to. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Now that getUpdateOptsForNode() is being called before inspection, we may be using it when the image values are not set for the host. We don't want to pass empty values to ironic, so the logic is restructured to only set values associated with the image when there are values to send. The general structure of the function is reorganized at the same time to deal with values coming from the hardware profile first, right after the profile is fetched, and to handle all of the image values next. Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
5e503bb
to
b0468b6
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.
Setting all of the Node options (except the image) prior to inspecting seems like a big change with unpredictable effects that could easily be avoided if our goal is just to fix this bug.
op = nodes.ReplaceOp | ||
p.log.Info("updating image_source") | ||
} | ||
// instance_uuid |
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'd have assumed we only want to set this when provisioning ('instance' here means Nova instance).
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.
IIUC, ironic doesn't use any of these values until it needs them, so setting them early shouldn't hurt. They're reset before provisioning, as well.
// Update the node settings in ironic to ensure we | ||
// have the boot mode configured, at least. | ||
var updates nodes.UpdateOpts | ||
updates, err = p.getUpdateOptsForNode(ironicNode) |
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.
This would seem a lot lower-risk if we just refactored the code for setting the boot mode option out of getUpdateOptsForNode() and only set that one here.
// cpu_arch | ||
// | ||
// FIXME(dhellmann): This should come from inspecting the | ||
// host. |
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.
We're now calling this func before inspection, which will make it hard to change this.
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.
It's not clear to me why we need to set this at all if it can come from inspection, but when we do drop the profile we would necessarily not set it here unless we did have inspection data.
// the API. That means we can safely update any status fields | ||
// along with the state. | ||
switch hsm.NextState { | ||
case metal3v1alpha1.StateRegistering, |
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.
Is there any point doing this before Registering when it's not copied to Ironic until we reach Inspecting?
I don't think it's safe to do this before #388 is merged, because right now this could end up changing the status of a provisioned Host so that the status would no longer match what we actually provisioned with.
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 can remove registering from the list here.
/hold Let's see how #645 looks instead of this one. |
@dhellmann: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This is no longer needed. |
We were previously only updating the host status copy of the boot mode
when we entered the inspecting state or provisioning states. This change
extends that to set it correctly during the registration process, too,
so that when the node is created in ironic it is given the right mode.
We were only updating the boot mode in ironic during registration and
during provisioning. This change updates the mode in ironic before
starting provisioning.