Support soft reboot - #151
Conversation
The daemon needs to know the pool's reboot policy to decide between a full reboot and a soft reboot. Add a RebootPolicy field to BootcNodeSpec, reusing the existing type from bootcnodepool_types.go. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Add Apply(ctx, softReboot) to the Executor interface. When softReboot is true, it runs bootc upgrade --from-downloaded --apply --soft-reboot=auto via nsenter, which performs a userspace-only restart when the kernel hasn't changed. Uses bootc upgrade (not switch) because current bink images predate bootc#2342 which adds --from-downloaded to switch. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Copy the pool's disruption.rebootPolicy to each BootcNode's spec on creation and on sync, following the same pattern as pullSecretRef propagation. Defaults to RebootOnly when the pool has no disruption spec. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
When the BootcNode's rebootPolicy is AllowSoftReboot, use Executor.Apply(ctx, true) instead of Executor.Reboot(ctx). This calls bootc with --soft-reboot=auto, which performs a userspace-only restart when the kernel hasn't changed, avoiding a full hardware reboot. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Verify the full soft reboot lifecycle: create a pool with AllowSoftReboot, trigger an update, and confirm the node comes back with the same boot ID (kernel stayed up, only userspace restarted). Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
| return ctrl.Result{}, fmt.Errorf("reboot: %w", err) | ||
| if res.softReboot { | ||
| log.Info("Applying update with soft reboot") | ||
| if err := r.Executor.Apply(ctx, true); err != nil { |
There was a problem hiding this comment.
Does this imply that soft reboot can only be performed with --download-only option? If yes, then that's not true for boot.c bootc update/switch both support --soft-reboot option
There was a problem hiding this comment.
No, it does not require --download-only. The --from-downloaded flag here just tells bootc to use the already-staged deployment without fetching from the registry again.
But it is not supported by operator It bypasses the drain. It does a full reboot in that case. cc @alicefr Can you please confirm this?
There was a problem hiding this comment.
it combines download + stage + reboot in one step in that case
There was a problem hiding this comment.
@HarshwardhanPatil07 @Johan-Liebert1 why cannot we let the operator reboots the node via systemctl reboot? As far as I understand, systemd is able to soft reboot, or doesn't bootc switch prepare for the next deployment? I'm not sure how bootc handle this case for soft reboot
There was a problem hiding this comment.
@alicefr systemctl reboot from the operator will skip the bootc-specific preparation.
on composefs, before calling the systemctl soft-reboot it prepares the target root under /run/nextroot
On OSTree, bootc calls deployment_set_soft_reboot() before
There was a problem hiding this comment.
bootc must first prepare which staged deployment systemd should enter and verify that the transition is safe.
There was a problem hiding this comment.
@HarshwardhanPatil07 @Johan-Liebert1 why cannot we let the operator reboots the node via systemctl reboot? As far as I understand, systemd is able to soft reboot, or doesn't bootc switch prepare for the next deployment? I'm not sure how bootc handle this case for soft reboot
bootc, does, in the end call systemctl soft-reboot, but we need to prepare the nextroot that we want to soft reboot into which consists of mounting the EROFS, preforming the /etc merge, and setting up composefs/ostree states depending on the backend
Rename Apply to ApplyUpdate for clarity per review feedback. Extract bootc command construction into builder functions (bootcStatusArgs, bootcSwitchArgs, bootcApplyUpdateArgs, systemctlRebootArgs) so all bootc invocations are defined in one place. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
f8a7506 to
c4881f7
Compare
|
Addressed |
|
FYI if you see ci failing, its because changed the cmd to bootc switch instead of bootc upgrade bootc-dev/bootc:2342 pr will land shortly in rpm |
More info below:
What I confirmed?
Also
Also
bn.spec.rebootPolicy: AllowSoftReboot was set on the BootcNode by the controller
Full reboot verification(different)
Also
Closes #117