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 kexec support #1076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Mstrodl
Copy link

@Mstrodl Mstrodl commented Feb 4, 2025

When --kexec is passed, an upgrade or switch will load
the new deployment into the kernel's kexec buffer

I don't know how to get a bootc dev environment quickly,
so it's very possible this doesn't actually work.
Please feel free to take this as a base and make changes :)

@Mstrodl Mstrodl force-pushed the feature/mstrodl/kexec branch 2 times, most recently from db47e9c to 585c7d3 Compare February 7, 2025 02:30
@Mstrodl
Copy link
Author

Mstrodl commented Feb 7, 2025

Related to, but doesn't fix #76

@lgarbarini
Copy link

lgarbarini commented Feb 8, 2025

I literally just sat down to make this change 😂. Just tested with bootc upgrade --kexec --apply on my dev environment and it just works! Thank you!

When --kexec is passed, an upgrade or switch will load
the new deployment into the kernel's kexec buffer

I don't know how to get a bootc dev environment quickly,
so it's very possible this doesn't actually work.
Please feel free to take this as a base and make changes :)

Signed-off-by: Mary Strodl <[email protected]>
@Mstrodl Mstrodl force-pushed the feature/mstrodl/kexec branch from 585c7d3 to 58be6bc Compare February 9, 2025 19:54
@lgarbarini
Copy link

@cgwalters this looks good to me! What else needs to be done to merge?

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Sorry for the delay and thanks so much for starting this!

Maybe it could work out more generally to have bootc prepare-kexec that can be applied as a secondary step after any operation?

Hmm also ideally this would be something visible in bootc status...digging in very slightly behind what kexec --status does it looks like there's /sys/kernel/kexec_loaded which just gives a 1 or 0...pretty primitive, but eh.

I guess we could store some state in e.g. /run/bootc...or hmm, arguably the ostree API should store something in the per-deployment state.

(I should have thought about this when we merged the ostree PR, but at the bootc level I really try hard to think about spec/status and machine readable APIs)

@@ -552,6 +573,12 @@ fn origin_from_imageref(imgref: &ImageReference) -> Result<glib::KeyFile> {
Ok(origin)
}

#[derive(Debug, Clone, Default)]
#[non_exhaustive]
pub(crate) struct StageOptions {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not opposed but this feels slightly overkill at this point - we don't have that many parameters to the function.

(And if we did we may as well move the progress writer in?)

I think a simple kexec: bool would be OK no?

Comment on lines +592 to +593
let steps_total = 4 + (deploy_kexec as u64);
let mut steps = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about:

let mut steps = 4;
if deploy_kexec {
  steps += 1;
}

?

Feels like it will "scale" a bit more cleanly if we have more conditionals later.

(This all said, I'd really like to have higher level wrappers for the progress API because the numbers here are SO easy to mess up)

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, that's pretty much the same idea, but I see how that would be cleaner.

Copy link
Author

Choose a reason for hiding this comment

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

I think I originally arrived at this from:

let steps_total = 4 + if deploy_kexec { 1 } else { 0 };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants