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

Add live-iso support #759

Merged
merged 3 commits into from
Jan 20, 2021
Merged

Add live-iso support #759

merged 3 commits into from
Jan 20, 2021

Conversation

hardys
Copy link
Member

@hardys hardys commented Jan 11, 2021

Alternative to #754

@dhellmann @zaneb PTAL - if you're happy with this interface I'll update the design doc PR

This is working but I'm planning to add some more tests and try to clean up the diff a little before removing WIP

@metal3-io-bot metal3-io-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 11, 2021
@hardys
Copy link
Member Author

hardys commented Jan 12, 2021

The new interface looks like:

  image:
    url: http://172.22.0.1/images/fedora-coreos-33.20201214.2.0-live.x86_64.iso
    format: live-iso

Copy link
Member

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

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

This implementation certainly looks simpler than the other. I have a few nits inline, but nothing worth holding up the review over.

apis/metal3.io/v1alpha1/baremetalhost_types.go Outdated Show resolved Hide resolved
pkg/provisioner/ironic/ironic.go Show resolved Hide resolved
pkg/provisioner/ironic/ironic.go Outdated Show resolved Hide resolved
op = nodes.AddOp
p.log.Info("adding boot_iso")
} else {
op = nodes.ReplaceOp
Copy link
Member

Choose a reason for hiding this comment

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

A weird property of JSON patch (at least as applied in ironic): add can be used to replace values (but not the other way).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, that sounds like a potential simplification we could address via a followup

pkg/provisioner/ironic/ironic.go Show resolved Hide resolved
pkg/provisioner/ironic/updateopts_test.go Outdated Show resolved Hide resolved
@hardys
Copy link
Member Author

hardys commented Jan 12, 2021

/retitle Add live-iso support

@metal3-io-bot metal3-io-bot changed the title WIP: Add live-iso support Add live-iso support Jan 12, 2021
@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 Jan 12, 2021
@hardys hardys mentioned this pull request Jan 12, 2021
@hardys
Copy link
Member Author

hardys commented Jan 13, 2021

/test-integration

@metal3-io-bot metal3-io-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 14, 2021
@hardys
Copy link
Member Author

hardys commented Jan 14, 2021

/test-integration

@hardys hardys requested a review from dhellmann January 14, 2021 13:26
Copy link
Member

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

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

This looks good. MUCH easier to understand than the version with separate fields, and not harder for the user to consume.

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.

Wow, this is so much simpler.

// To make it easier to test if ironic is configured with
// the same image we are trying to provision to the host.
if p.host.Spec.Image != nil && p.host.Spec.Image.DiskFormat != nil && *p.host.Spec.Image.DiskFormat == "live-iso" {
sameImage = (ironicNode.InstanceInfo["boot_iso"] == p.host.Spec.Image.URL)
Copy link
Member

Choose a reason for hiding this comment

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

This is not cleared from Ironic when switching back from live-iso to a regular boot, so it may not be operative. I think we should either clear it at the same time as setting deploy_interface back to direct, or also verify the deploy_interface here, or both.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah thanks, good catch - I updated getImageUpdateOptsForNode to account for this, and added tests for both image->iso and iso->image in updateopts_test.go

I'm not sure adding an explicit check for deploy_interface here gains us much though, since in that case we expect *p.host.Spec.Image.DiskFormat to change from live-iso to something else, then we'll hit the else and the checksum/image_source values in ironicNode.InstanceInfo will always be empty, so sameImage will always evaluate to false AFAICT?

That said, it does raise the question of whether we should check *p.host.Spec.Image.DiskFormat since in any other change of disk-format we might want to set sameImage to false, even if the URL is the same? I guess that's something to potentially address in a different PR though.

Copy link
Member

Choose a reason for hiding this comment

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

Agree that doing both is redundant. (Wouldn't hurt, in a belt-and-braces sense, but this is fine too.)

You make a good point though that if provisioning fails because you specified the wrong image format, and you then fix it, it currently won't retry, at least on paper. I'm not actually even 100% sure this code is still needed, since after a failure is first recorded we change the state to Deprovisioning. Definitely a question for elsewhere though.

Copy link
Contributor

@imain imain left a comment

Choose a reason for hiding this comment

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

Looks good to me Stephen.

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhellmann, hardys, imain

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

Steven Hardy added 3 commits January 20, 2021 11:28
@metal3-io-bot metal3-io-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 20, 2021
@zaneb
Copy link
Member

zaneb commented Jan 20, 2021

/test-integration
/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2021
@metal3-io-bot metal3-io-bot merged commit d921a06 into metal3-io:master Jan 20, 2021
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. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants