Files
snapd/tests/lib/external
Samuele Pedroni c61caff7fd many: avoid automatic system restarts on classic through new overlord/restart logic (#12228)
* o/state: fix pendingChangeByAttr initialisation when loading state

* o/restart,o/state: introduce restart.FinishTaskWithRestart

this combines setting the status of a task being finished and requesting a
restart

it will also replace rebooting the system on classic with setting the task into
HoldStatus until a manual system restart occurs

moving the task from HoldStatus to DoneStatus is implemented with
RestartManager.StartUp logic based on extra state attributes to track reboot on
such task and its change

to avoid such pending changes to be pruned prematurely a predicate
RestartManager.PendingForSystemRestart is registered with
State.RegisterPendingChangeByAttr

* overlord: delegate from snapstate.FinishTaskWithRestart to restart

this gives us the right behavior on classic now

adjust tests to the expected behavior, fixing previous XXXs

* o/snapstate: switch around NoErrorOrHold to IsErrAndNotHold

this way fewer places need to negate it

thanks MiguelPires

* o/restart: simplify things a bit turning held-for-system-restart into just a flag

on the Change, instead of a full counter

* o/restart: try to clarify FinishTaskWithRestart behavior in comment

* o/state: do not attempt to run tasks in WaitStatus

the lack of this logic was causing a panic,
given that for now we expect the new status to be used
only on new system revert is not an issue. But if we started
using WaitStatus in preexisting system/scenarios we would
have to think how to deal with this backward incompatibility

* overlord: switch logic to use WaitStatus instead of HoldStatus

* tests: enable kernel refresh testing

the gadget case is still not working, needs more investigation

* tests/fde-on-classic: re-enable test for gadget updates

which was failing because two reboots were happening as the kernel
command line from the manually written grub.cfg was not matching the
one shipped by snapd.

* tests/fde-on-classic: make sure that modeenv kernel command line

matches the one in snapd/grub.cfg.

* tests: check in fde-on-classic test that remote host has no reboot scheduled

* boot: add debug about cmdline updates

* tests: cherry pick https://github.com/snapcore/snapd-testing-tools/pull/33

* tests: update nested fde-on-classic cmdline to match what grub-recovery.cfg writes

Co-authored-by: Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
Co-authored-by: Michael Vogt <mvo@ubuntu.com>
2022-11-17 09:39:17 +01:00
..