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

ensure the boot mode is set in ironic before starting inspection #635

Closed
wants to merge 5 commits into from

Conversation

dhellmann
Copy link
Member

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.

@metal3-io-bot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 15, 2020
@dhellmann dhellmann changed the title ensure the boot mode is set in ironic before starting inspection WIP: ensure the boot mode is set in ironic before starting inspection Sep 15, 2020
@metal3-io-bot metal3-io-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2020
@dhellmann
Copy link
Member Author

/test-integration

@dhellmann dhellmann changed the title WIP: ensure the boot mode is set in ironic before starting inspection ensure the boot mode is set in ironic before starting inspection Sep 16, 2020
@metal3-io-bot metal3-io-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2020
@dhellmann dhellmann changed the title ensure the boot mode is set in ironic before starting inspection WIP: ensure the boot mode is set in ironic before starting inspection Sep 16, 2020
@metal3-io-bot metal3-io-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2020
@dhellmann dhellmann changed the title WIP: ensure the boot mode is set in ironic before starting inspection ensure the boot mode is set in ironic before starting inspection Sep 16, 2020
@metal3-io-bot metal3-io-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2020
@dhellmann
Copy link
Member Author

/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")
Copy link
Member

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?

Copy link
Member Author

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.

@hardys
Copy link
Member

hardys commented Sep 17, 2020

lgtm but needs a rebase

@dhellmann
Copy link
Member Author

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>
Copy link
Member

@zaneb zaneb left a 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
Copy link
Member

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).

Copy link
Member Author

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)
Copy link
Member

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.
Copy link
Member

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.

Copy link
Member Author

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,
Copy link
Member

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.

Copy link
Member Author

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.

@dhellmann
Copy link
Member Author

/hold

Let's see how #645 looks instead of this one.

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 21, 2020
@metal3-io-bot
Copy link
Contributor

@dhellmann: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
gomod b0468b6 link /test gomod

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.

@dhellmann
Copy link
Member Author

This is no longer needed.

@dhellmann dhellmann closed this Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants