-
Notifications
You must be signed in to change notification settings - Fork 582
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
base: master
Are you sure you want to change the base?
o/{ifacestate,snapstate}: delay reboot when we have kernel-modules #14733
Conversation
Opening as draft for the moment to see state of the test. |
f05becd
to
353a40c
Compare
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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: "", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
overlord/snapstate/handlers.go
Outdated
csups := make([]ComponentSetup, 0, len(compsups)) | ||
for _, c := range compsups { | ||
csups = append(csups, *c) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused slice here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
csups := make([]ComponentSetup, 0, len(compsups)) | ||
for _, c := range compsups { | ||
csups = append(csups, *c) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
if rebootInfo.RebootRequired { | ||
return m.finishTaskWithMaybeRestart(t, state.DoneStatus, | ||
restartPossibility{info: newInfo, RebootInfo: rebootInfo}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
overlord/snapstate/handlers.go
Outdated
csups := make([]ComponentSetup, 0, len(compsups)) | ||
for _, c := range compsups { | ||
csups = append(csups, *c) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
csups := make([]ComponentSetup, 0, len(compsups)) | ||
for _, c := range compsups { | ||
csups = append(csups, *c) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
if rebootInfo.RebootRequired { | ||
return m.finishTaskWithMaybeRestart(t, state.DoneStatus, | ||
restartPossibility{info: newInfo, RebootInfo: rebootInfo}) |
There was a problem hiding this comment.
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: "", |
There was a problem hiding this comment.
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.
4d2d2a6
to
b209258
Compare
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some initial questions
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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?
There was a problem hiding this 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
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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/handlers.go
Outdated
return err | ||
} | ||
if needsFinishRestart { | ||
logger.Debugf("finish restart from doAutoConnect") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.Debugf("finish restart from doAutoConnect") | |
logger.Debugf("finish restart from doDiscardOldKernelSnapSetup") |
overlord/snapstate/snapstate.go
Outdated
if setupKmodComponents != nil { | ||
setupKmodComponents.Set("prepare-restart", restartInSetupKmods) | ||
} | ||
if afterSetupKmodComps != nil { | ||
afterSetupKmodComps.Set("finish-restart", restartInSetupKmods) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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?
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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
Outdated
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) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
// 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
return m.finishTaskWithMaybeRestart(t, state.DoneStatus, | ||
restartPossibility{info: newInfo, RebootInfo: rebootInfo}) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
.
There was a problem hiding this 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
overlord/snapstate/snapstate.go
Outdated
if setupKmodComponents != nil { | ||
setupKmodComponents.Set("prepare-restart", restartInSetupKmods) | ||
} | ||
if afterSetupKmodComps != nil { | ||
afterSetupKmodComps.Set("finish-restart", restartInSetupKmods) | ||
} |
There was a problem hiding this comment.
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
overlord/snapstate/snapstate.go
Outdated
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) | ||
} |
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
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
.
overlord/ifacestate/handlers.go
Outdated
@@ -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 && |
There was a problem hiding this comment.
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.
// 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. |
There was a problem hiding this comment.
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.
return m.finishTaskWithMaybeRestart(t, state.DoneStatus, | ||
restartPossibility{info: newInfo, RebootInfo: rebootInfo}) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
overlord/snapstate/handlers.go
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you
There was a problem hiding this 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
overlord/snapstate/snapstate.go
Outdated
@@ -985,16 +1014,32 @@ func isInvokedWithRevert() bool { | |||
return os.Getenv("SNAPD_REVERT_TO_REV") != "" | |||
} | |||
|
|||
// FinishRestartOpts are options for FinishRestart. | |||
type FinishRestartOpts struct { |
There was a problem hiding this comment.
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.
type FinishRestartOpts struct { | |
type FinishRestartOptions struct { |
There was a problem hiding this comment.
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
Outdated
// FinishRestartOpts are options for FinishRestart. | ||
type FinishRestartOpts struct { | ||
// Set to the default behavior if finish-restart is not set in the task. | ||
RunIfOldChange bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RunIfOldChange bool | |
FinishRestartDefault bool |
There was a problem hiding this comment.
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
Outdated
@@ -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. |
There was a problem hiding this comment.
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
// 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrased a bit
// 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. |
There was a problem hiding this comment.
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.
d902299
to
9c6ee64
Compare
@Meulengracht thanks, I've addressed your comments now. I've also squashed commits. |
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.