Skip to content

Commit

Permalink
fix: don't run kexec prepare on shutdown and reset
Browse files Browse the repository at this point in the history
We don't expect to kexec on these actions, so no need to run kexec which
might fail blocking those two actions.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Nov 17, 2021
1 parent 6dcce20 commit 030fd34
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (*Sequencer) ApplyConfiguration(r runtime.Runtime, req *machineapi.ApplyCon
"cleanup",
StopAllPods,
).AppendList(
stopAllPhaselist(r),
stopAllPhaselist(r, true),
).Append(
"reboot",
Reboot,
Expand Down Expand Up @@ -289,7 +289,7 @@ func (*Sequencer) Reboot(r runtime.Runtime) []runtime.Phase {
"cleanup",
StopAllPods,
).
AppendList(stopAllPhaselist(r)).
AppendList(stopAllPhaselist(r, true)).
Append("reboot", Reboot)

return phases
Expand All @@ -301,7 +301,7 @@ func (*Sequencer) Reset(r runtime.Runtime, in runtime.ResetOptions) []runtime.Ph

switch r.State().Platform().Mode() { //nolint:exhaustive
case runtime.ModeContainer:
phases = phases.AppendList(stopAllPhaselist(r)).
phases = phases.AppendList(stopAllPhaselist(r, false)).
Append(
"shutdown",
Shutdown,
Expand All @@ -324,7 +324,7 @@ func (*Sequencer) Reset(r runtime.Runtime, in runtime.ResetOptions) []runtime.Ph
"leave",
LeaveEtcd,
).AppendList(
stopAllPhaselist(r),
stopAllPhaselist(r, false),
).AppendWhen(
len(in.GetSystemDiskTargets()) == 0,
"reset",
Expand Down Expand Up @@ -354,7 +354,7 @@ func (*Sequencer) Shutdown(r runtime.Runtime) []runtime.Phase {
"cleanup",
StopAllPods,
).
AppendList(stopAllPhaselist(r)).
AppendList(stopAllPhaselist(r, false)).
Append("shutdown", Shutdown)

return phases
Expand All @@ -376,7 +376,7 @@ func (*Sequencer) StageUpgrade(r runtime.Runtime, in *machineapi.UpgradeRequest)
"leave",
LeaveEtcd,
).AppendList(
stopAllPhaselist(r),
stopAllPhaselist(r, true),
).Append(
"reboot",
Reboot,
Expand Down Expand Up @@ -453,7 +453,7 @@ func (*Sequencer) Upgrade(r runtime.Runtime, in *machineapi.UpgradeRequest) []ru
return phases
}

func stopAllPhaselist(r runtime.Runtime) PhaseList {
func stopAllPhaselist(r runtime.Runtime, enableKexec bool) PhaseList {
phases := PhaseList{}

switch r.State().Platform().Mode() { //nolint:exhaustive
Expand All @@ -480,13 +480,16 @@ func stopAllPhaselist(r runtime.Runtime) PhaseList {
"unmountSystem",
UnmountEphemeralPartition,
UnmountStatePartition,
).Append(
).AppendWhen(
enableKexec,
"mountBoot",
MountBootPartition,
).Append(
).AppendWhen(
enableKexec,
"kexec",
KexecPrepare,
).Append(
).AppendWhen(
enableKexec,
"unmountBoot",
UnmountBootPartition,
)
Expand Down

0 comments on commit 030fd34

Please sign in to comment.