Skip to content

Support soft reboot - #151

Open
HarshwardhanPatil07 wants to merge 6 commits into
bootc-dev:mainfrom
HarshwardhanPatil07:soft-reboot
Open

Support soft reboot#151
HarshwardhanPatil07 wants to merge 6 commits into
bootc-dev:mainfrom
HarshwardhanPatil07:soft-reboot

Conversation

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator

More info below:

What I confirmed?

Aug 25 11:57:33 worker1 systemd[1]: Stopped run-p2811-i2812.service - [systemd-run] /usr/bin/systemctl reboot "--message=Initiated by bootc".
Aug 25 11:57:37 worker1 systemd[1]: systemd-soft-reboot.service: Deactivated successfully.
Aug 25 11:57:37 worker1 systemd[1]: Finished systemd-soft-reboot.service - Reboot System Userspace.
Aug 25 11:57:37 worker1 systemd[1]: Reached target soft-reboot.target - Reboot System Userspace.
Aug 25 11:57:37 worker1 systemd[1]: Stopped target soft-reboot.target - Reboot System Userspace.

Also

Boot ID BEFORE: 2ee4c375-c4eb-4ffc-998d-112ad41e7f1f
Boot ID AFTER:  2ee4c375-c4eb-4ffc-998d-112ad41e7f1f

Also
bn.spec.rebootPolicy: AllowSoftReboot was set on the BootcNode by the controller

Full reboot verification(different)

Aug 25 12:36:54 worker2 systemd[1]: Reload requested from client PID 1044 ('systemctl') (unit cloud-init-main.service)...
Aug 25 12:37:03 worker2 systemd[1]: Reload requested from client PID 1239 ('systemctl') (unit session-4.scope)...
Aug 25 12:38:11 worker2 systemd[1]: Shutting down.
Aug 25 12:38:20 worker2 kernel: ISO 9660 Extensions: Microsoft Joliet Level 3

Also

Boot ID BEFORE: 6a9276a4-c6d7-4353-bb47-286c14b87df0
Boot ID AFTER:  46decf0b-f5b8-4a6e-90bb-6a4dc55986a8

Closes #117

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>
@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

Comment thread internal/bootc/executor.go Outdated
Comment thread internal/bootc/executor.go Outdated
Comment thread internal/bootc/executor.go Outdated
Comment thread internal/daemon/reconciler.go Outdated
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 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it combines download + stage + reboot in one step in that case

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@jlebon did had the same thing in mind i guess. ref: #117

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

bootc must first prepare which staged deployment systemd should enter and verify that the transition is safe.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@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

Comment thread internal/bootc/executor.go Outdated
Comment thread test/e2e/bootcnode_test.go
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>
@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

Addressed

@HarshwardhanPatil07

Copy link
Copy Markdown
Collaborator Author

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

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.

Support soft reboot

4 participants