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

o/{ifacestate,snapstate}: delay reboot when we have kernel-modules #14733

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alfonsosanchezbeato
Copy link
Member

Delay reboot when we are installing/updating/removing kernel-modules
components jointly with a kernel refresh so it happens after the
refresh hooks have run. With this we ensure that the kernel modules
shipped in the component or built from the hooks is available at the
same time as the other modules after rebooting.

@alfonsosanchezbeato
Copy link
Member Author

Opening as draft for the moment to see state of the test.

@alfonsosanchezbeato alfonsosanchezbeato added the Run nested The PR also runs tests inluded in nested suite label Nov 15, 2024
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 69.91870% with 37 lines in your changes missing coverage. Please review.

Project coverage is 79.02%. Comparing base (96ea7b0) to head (353a40c).
Report is 75 commits behind head on master.

Files with missing lines Patch % Lines
overlord/snapstate/handlers_components.go 57.77% 12 Missing and 7 partials ⚠️
overlord/snapstate/handlers.go 66.66% 8 Missing and 4 partials ⚠️
overlord/ifacestate/handlers.go 25.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14733      +/-   ##
==========================================
+ Coverage   78.95%   79.02%   +0.07%     
==========================================
  Files        1084     1087       +3     
  Lines      146638   147734    +1096     
==========================================
+ Hits       115773   116742     +969     
- Misses      23667    23751      +84     
- Partials     7198     7241      +43     
Flag Coverage Δ
unittests 79.02% <69.91%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

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

Thanks, just some small things!

@@ -15556,7 +15580,7 @@ func (s *snapmgrTestSuite) TestUpdateWithComponentsRunThroughAdditionalComponent

func (s *snapmgrTestSuite) TestUpdateWithComponentsRunThroughAdditionalComponentsAlreadyInstalled(c *C) {
s.testUpdateWithComponentsRunThrough(c, updateWithComponentsOpts{
instanceKey: "key",
instanceKey: "",
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, is this changed because kernel snaps cannot have instance keys? This does remove some of the cases that we're testing.

Same with TestInstallInstanceManyComponentsRunThrough now installing only one component, the intent of that test was to install multiple components.

Copy link
Member Author

Choose a reason for hiding this comment

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

There was an issue with these test as now I had to improve the emulation of kernel updates in the tests. I have done changes now so both kernel and applications snaps using instances are tested.

Comment on lines 2290 to 2293
csups := make([]ComponentSetup, 0, len(compsups))
for _, c := range compsups {
csups = append(csups, *c)
}
Copy link
Member

Choose a reason for hiding this comment

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

Unused slice here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 712 to 715
csups := make([]ComponentSetup, 0, len(compsups))
for _, c := range compsups {
csups = append(csups, *c)
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here, unused.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 768 to 770
if rebootInfo.RebootRequired {
return m.finishTaskWithMaybeRestart(t, state.DoneStatus,
restartPossibility{info: newInfo, RebootInfo: rebootInfo})
Copy link
Member

Choose a reason for hiding this comment

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

Could this half of this if statement go in the above if statement's block? Since this shouldn't ever be true if we don't have a valid rebootInfo? Then, rebootInfo could be scoped to that block.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed... I was a bit hesitant about this as I don't like non-error returns to be in the middle of a method, but this looks close enough to the end.

Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

@andrewphelpsj thanks for the review, I've addressed your comment now. I am also removing the draft status.

Comment on lines 2290 to 2293
csups := make([]ComponentSetup, 0, len(compsups))
for _, c := range compsups {
csups = append(csups, *c)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 712 to 715
csups := make([]ComponentSetup, 0, len(compsups))
for _, c := range compsups {
csups = append(csups, *c)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 768 to 770
if rebootInfo.RebootRequired {
return m.finishTaskWithMaybeRestart(t, state.DoneStatus,
restartPossibility{info: newInfo, RebootInfo: rebootInfo})
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed... I was a bit hesitant about this as I don't like non-error returns to be in the middle of a method, but this looks close enough to the end.

@@ -15556,7 +15580,7 @@ func (s *snapmgrTestSuite) TestUpdateWithComponentsRunThroughAdditionalComponent

func (s *snapmgrTestSuite) TestUpdateWithComponentsRunThroughAdditionalComponentsAlreadyInstalled(c *C) {
s.testUpdateWithComponentsRunThrough(c, updateWithComponentsOpts{
instanceKey: "key",
instanceKey: "",
Copy link
Member Author

Choose a reason for hiding this comment

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

There was an issue with these test as now I had to improve the emulation of kernel updates in the tests. I have done changes now so both kernel and applications snaps using instances are tested.

@alfonsosanchezbeato alfonsosanchezbeato marked this pull request as ready for review November 18, 2024 22:01
@alfonsosanchezbeato alfonsosanchezbeato force-pushed the delay-kernel-reboot branch 2 times, most recently from 4d2d2a6 to b209258 Compare November 19, 2024 12:57
@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Member

Choose a reason for hiding this comment

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

So in regards to the introduction of the following new task variables finish-restart and prepare-restart - what happens when an update, which needs to reboot, is scheduled before snapd is updated to this version?

Snapd updates first, then the other essential snaps update, but at this point the change does not have any task that sets either prepare-restart or finish-restart. What happens in this case? This is not entirely clear for me

Copy link
Member Author

Choose a reason for hiding this comment

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

When the variables are not set (old snapd running when creating the change), the behavior is the same as in the past, even with newer snapd running the tasks. What is an actual difference is that discard-old-kernel-snap-setup has moved but looking at the code there we are safe regardless of the order and the snapd version.

Said this, there is no kernel yet deployed using kernel-modules, so we are also safe if this gets into 2.67.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, I'm confused as if the finish-restart is not set needsFinishRestart is false, no? so we will not have the old behavior

Copy link
Collaborator

Choose a reason for hiding this comment

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

also wouldn't it make more sense to deal with the new field inside snapstate.FinishRestart itself? it receives the task anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, the default value needs to capture the old behavior, I've changed this now. To make this work, I also make sure now that all the related tasks receive a value with either true or false so we can differentiate from the case where there is no value set. I have not moved the checks to FinishRestart as in that case I would need to look at the kind of task to decide what to do if there is no value set.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you could also pass the default behavior boolean in though instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need a test in the package that tests the "finish-restart" false behavior?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed FinishRestart now. Test for it added too.

Copy link
Member

@Meulengracht Meulengracht left a comment

Choose a reason for hiding this comment

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

Looks really nice overall, but couple of questions

@pedronis pedronis added this to the 2.67 milestone Nov 20, 2024
Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

some initial questions

@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, I'm confused as if the finish-restart is not set needsFinishRestart is false, no? so we will not have the old behavior

@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

also wouldn't it make more sense to deal with the new field inside snapstate.FinishRestart itself? it receives the task anyway?

overlord/snapstate/snapstate.go Show resolved Hide resolved
Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

@pedronis @Meulengracht thanks for the reviews, I've addressed your comments now

@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, the default value needs to capture the old behavior, I've changed this now. To make this work, I also make sure now that all the related tasks receive a value with either true or false so we can differentiate from the case where there is no value set. I have not moved the checks to FinishRestart as in that case I would need to look at the kind of task to decide what to do if there is no value set.

overlord/snapstate/snapstate.go Show resolved Hide resolved
overlord/snapstate/snapstate.go Show resolved Hide resolved
overlord/snapstate/snapstate.go Show resolved Hide resolved
return err
}
if needsFinishRestart {
logger.Debugf("finish restart from doAutoConnect")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.Debugf("finish restart from doAutoConnect")
logger.Debugf("finish restart from doDiscardOldKernelSnapSetup")

Comment on lines 812 to 815
if setupKmodComponents != nil {
setupKmodComponents.Set("prepare-restart", restartInSetupKmods)
}
if afterSetupKmodComps != nil {
afterSetupKmodComps.Set("finish-restart", restartInSetupKmods)
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we not just set those up in the else above? Then we can save the restartInSetupKmods bool?

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved now, hopefully it looks simpler now

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

did another pass, some more comments/questions

@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could also pass the default behavior boolean in though instead?

@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need a test in the package that tests the "finish-restart" false behavior?

overlord/snapstate/snapstate.go Show resolved Hide resolved
Comment on lines 810 to 815
linkSnap.Set("prepare-restart", restartInLink)
autoConnect.Set("finish-restart", restartInLink)
if setupKmodComponents != nil {
setupKmodComponents.Set("prepare-restart", restartInSetupKmods)
}
if afterSetupKmodComps != nil {
afterSetupKmodComps.Set("finish-restart", restartInSetupKmods)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems overly complicated, can't we fold these into the previous ifs and don't have the flags? or just have the flag restartInSetupKmods, both flags cannot be true at the same time?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

overlord/snapstate/snapstate.go Show resolved Hide resolved
Comment on lines +736 to +742
// TODO we have to revert changes in bootloader config/modeenv if an
// error happens later in this method. This is not likely as possible
// errors after this would happen only due to internal errors or not
// being able to write to the filesystem, but still. There is also the
// question of what would happen if a restart happens when the boot
// configuration has been already written but DoneStatus in the state
// has not.
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we happy with the reboot placement on the undo paths?

Copy link
Member Author

Choose a reason for hiding this comment

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

In principle we are, "unlink-snap" and "unlink-current-snap" still look as the right places to reboot when undoing even when there are kernel-modules. cc @Meulengracht in case he difers.

Copy link
Member

Choose a reason for hiding this comment

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

I think the reboot placement along undo still is correct

Comment on lines +758 to +759
return m.finishTaskWithMaybeRestart(t, state.DoneStatus,
restartPossibility{info: newInfo, RebootInfo: rebootInfo})
Copy link
Collaborator

Choose a reason for hiding this comment

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

tests don't exercise this afaict

Copy link
Member Author

Choose a reason for hiding this comment

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

I've improved the tests that call testUpdateWithComponentsRunThrough so this is now exercized.

// Set the default to false for compatibility with older snapd (case of
// joint refresh of snapd and kernel).
prepareRestart := false
if err := t.Get("prepare-restart", &prepareRestart); err != nil &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't prepare-restart doubling what the restart-boundary should also indicates? I understand that is trickier for the finish-restart bit as the task is not the boundary one

Copy link
Member Author

Choose a reason for hiding this comment

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

Not exactly, restart-boundary is set only for one of the snaps that want a reboot in a change. But, we need to call MaybeSetNextBoot for all snaps that want a reboot, as they need to do different things in preparation for the reboot. We also need to call finishTaskWithMaybeRestart in all these cases I believe. On the other hand, the kernel snap is the one getting the restart-bounday flag if part of a refresh change (see essentialSnapsRestartOrder), so maybe what you suggest is doable, but sounds too implicit and asymmetric as we need still finish-restart.

Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

Thanks for the reviews, I've pushed changes now

Comment on lines 812 to 815
if setupKmodComponents != nil {
setupKmodComponents.Set("prepare-restart", restartInSetupKmods)
}
if afterSetupKmodComps != nil {
afterSetupKmodComps.Set("finish-restart", restartInSetupKmods)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved now, hopefully it looks simpler now

Comment on lines 810 to 815
linkSnap.Set("prepare-restart", restartInLink)
autoConnect.Set("finish-restart", restartInLink)
if setupKmodComponents != nil {
setupKmodComponents.Set("prepare-restart", restartInSetupKmods)
}
if afterSetupKmodComps != nil {
afterSetupKmodComps.Set("finish-restart", restartInSetupKmods)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

// Set the default to false for compatibility with older snapd (case of
// joint refresh of snapd and kernel).
prepareRestart := false
if err := t.Get("prepare-restart", &prepareRestart); err != nil &&
Copy link
Member Author

Choose a reason for hiding this comment

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

Not exactly, restart-boundary is set only for one of the snaps that want a reboot in a change. But, we need to call MaybeSetNextBoot for all snaps that want a reboot, as they need to do different things in preparation for the reboot. We also need to call finishTaskWithMaybeRestart in all these cases I believe. On the other hand, the kernel snap is the one getting the restart-bounday flag if part of a refresh change (see essentialSnapsRestartOrder), so maybe what you suggest is doable, but sounds too implicit and asymmetric as we need still finish-restart.

@@ -1386,9 +1386,17 @@ func (m *InterfaceManager) doAutoConnect(task *state.Task, _ *tomb.Tomb) error {
// if this is the case we can only proceed once the restart
// has happened or we may not have all the interfaces of the
// new core/base snap.
if err := snapstateFinishRestart(task, snapsup); err != nil {
needsFinishRestart := false
if err := task.Get("finish-restart", &needsFinishRestart); err != nil &&
Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed FinishRestart now. Test for it added too.

Comment on lines +736 to +742
// TODO we have to revert changes in bootloader config/modeenv if an
// error happens later in this method. This is not likely as possible
// errors after this would happen only due to internal errors or not
// being able to write to the filesystem, but still. There is also the
// question of what would happen if a restart happens when the boot
// configuration has been already written but DoneStatus in the state
// has not.
Copy link
Member Author

Choose a reason for hiding this comment

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

In principle we are, "unlink-snap" and "unlink-current-snap" still look as the right places to reboot when undoing even when there are kernel-modules. cc @Meulengracht in case he difers.

Comment on lines +758 to +759
return m.finishTaskWithMaybeRestart(t, state.DoneStatus,
restartPossibility{info: newInfo, RebootInfo: rebootInfo})
Copy link
Member Author

Choose a reason for hiding this comment

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

I've improved the tests that call testUpdateWithComponentsRunThrough so this is now exercized.

overlord/snapstate/snapstate.go Show resolved Hide resolved
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thank you, couple small remarks

@@ -15803,6 +15830,36 @@ func (s *snapmgrTestSuite) testUpdateWithComponentsRunThrough(c *C, opts updateW
})
c.Assert(err, IsNil)

// Check boundaries are in the expected tasks
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we Get("restart-boundary"...) and check it directly as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -2283,14 +2283,14 @@ func (m *SnapManager) doLinkSnap(t *state.Task, _ *tomb.Tomb) (err error) {
return err
}

// Prepare for rebooting for snaps that need it. Note that if we have
// Set next boot for snaps that need it. Note that if we have
// kernel-modules components this gets delayed as it happens in the
// "prepare-kernel-modules-components" task. The default is set to
// true for compatibility with older snapd (case of joint refresh of
// snapd and kernel).
var rebootInfo boot.RebootInfo
prepareRestart := true
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't we change the var name as well? same in other places?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thank you

Copy link
Member

@Meulengracht Meulengracht left a comment

Choose a reason for hiding this comment

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

Couple of final remarks surrounding the new structure

@@ -985,16 +1014,32 @@ func isInvokedWithRevert() bool {
return os.Getenv("SNAPD_REVERT_TO_REV") != ""
}

// FinishRestartOpts are options for FinishRestart.
type FinishRestartOpts struct {
Copy link
Member

Choose a reason for hiding this comment

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

In relations to naming structure types as 'Opts' vs 'Options', we seem to be mostly biased towards spelling it out to FinishRestartOptions by doing a search in our code. (35 results vs 130 results). Let's try to stick to the Options pattern.

Suggested change
type FinishRestartOpts struct {
type FinishRestartOptions struct {

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

// FinishRestartOpts are options for FinishRestart.
type FinishRestartOpts struct {
// Set to the default behavior if finish-restart is not set in the task.
RunIfOldChange bool
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
RunIfOldChange bool
FinishRestartDefault bool

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

@@ -985,16 +1014,32 @@ func isInvokedWithRevert() bool {
return os.Getenv("SNAPD_REVERT_TO_REV") != ""
}

// FinishRestartOpts are options for FinishRestart.
type FinishRestartOpts struct {
// Set to the default behavior if finish-restart is not set in the task.
Copy link
Member

Choose a reason for hiding this comment

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

I would like to see a more detailed explanation for this, my suggestion

Suggested change
// Set to the default behavior if finish-restart is not set in the task.
// FinishRestartDefault sets the default behavior for whether FinishRestart should finalize the restart. For tasks that exists before this introduction, this should be true, otherwise false.

Copy link
Member Author

Choose a reason for hiding this comment

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

Rephrased a bit

Comment on lines +736 to +742
// TODO we have to revert changes in bootloader config/modeenv if an
// error happens later in this method. This is not likely as possible
// errors after this would happen only due to internal errors or not
// being able to write to the filesystem, but still. There is also the
// question of what would happen if a restart happens when the boot
// configuration has been already written but DoneStatus in the state
// has not.
Copy link
Member

Choose a reason for hiding this comment

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

I think the reboot placement along undo still is correct

Delay reboot when we are installing/updating/removing kernel-modules
components jointly with a kernel refresh so it happens after the
refresh hooks have run. With this we ensure that the kernel modules
shipped in the component or built from the hooks is available at the
same time as the other modules after rebooting.
Test that modules from kernel-modules components are available early
after rebooting.
@alfonsosanchezbeato
Copy link
Member Author

@Meulengracht thanks, I've addressed your comments now. I've also squashed commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run nested The PR also runs tests inluded in nested suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants