-
Notifications
You must be signed in to change notification settings - Fork 254
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 LiveImage support #754
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,16 +293,25 @@ func (hsm *hostStateMachine) provisioningCancelled() bool { | |
if hsm.Host.HasError() { | ||
return true | ||
} | ||
if hsm.Host.Spec.Image == nil { | ||
if hsm.Host.Spec.Image == nil && hsm.Host.Spec.LiveImage == nil { | ||
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. This logic is very similar to the BMH NeedsProvisioning() - I wonder if we could use the inverse of that here instead of duplicating nearly the same conditionals? 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. This used to be the NeedsDeprovisioning() method; we moved it here because having methods on the BMH object is actually bad. They're not inverses of each other. |
||
return true | ||
} | ||
if hsm.Host.Spec.Image.URL == "" { | ||
if hsm.Host.Spec.LiveImage != nil && hsm.Host.Spec.LiveImage.URL == "" { | ||
return true | ||
} | ||
if hsm.Host.Status.Provisioning.Image.URL == "" { | ||
if hsm.Host.Spec.LiveImage != nil && hsm.Host.Status.Provisioning.LiveImage.URL == "" { | ||
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. This doesn't handle the case where Spec.LiveImage is set and Status.Provisioning.Image.URL is also set, in which case we want to return true. Similarly, below we don't handle the case where Spec.Image is set and Status.Provisioning.LiveImage.URL is also set. I think the correct logic is something like:
Assuming that 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. Thanks for the review @zaneb - In the docstring I do mention that only Image or LiveImage should be set, but I agree long term they should be validated as mutually exclusive. Re the ISO flag, that was my original proposal but this approach was preferred since it's possible we might support a live kernel/ramdisk in future, and the checksum argument to the current Image section currently isn't applicable to the LiveImage case: metal3-io/metal3-docs#150 (comment) |
||
return false | ||
} | ||
if hsm.Host.Spec.Image.URL != hsm.Host.Status.Provisioning.Image.URL { | ||
if hsm.Host.Spec.LiveImage != nil && hsm.Host.Spec.LiveImage.URL != hsm.Host.Status.Provisioning.LiveImage.URL { | ||
return true | ||
} | ||
if hsm.Host.Spec.Image != nil && hsm.Host.Spec.Image.URL == "" { | ||
return true | ||
} | ||
if hsm.Host.Spec.Image != nil && hsm.Host.Status.Provisioning.Image.URL == "" { | ||
return false | ||
} | ||
if hsm.Host.Spec.Image != nil && hsm.Host.Spec.Image.URL != hsm.Host.Status.Provisioning.Image.URL { | ||
return true | ||
} | ||
return false | ||
|
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 may need to make the logic in this function a bit more complicated to deal with switching a host from live image to provisioned image, because in that case we may have a non-nil pointer to a struct with an empty string for the live image and we would want to treat that as though the image was set. We can probably deal with that case in another PR, after we have the basic case working.