Add auto rollback functionality with reboot (savepoint and commit)
After some discussion with @ljelinek I come up with idea to have automatic rollbacks with restart. The functionality would be that you could call something as schnapps savepoint
(optionally setup reboot with some timeout) and do configuration that could potentially cut you from router. When all goes correctly then user could call schnapps commit
to discard savepoint.
The use case is to simply make remote management even more resilient against breakage without even needing someone to go to location and rollback router using button. Also it is easier to explain router restart (just pull power out and plug it back in) than rollback to other people.
The implementation details would be that schnapps would simply move current root (@
) to snapshot (same as it is done with rollback) and marked it by new type savepoint
. In place of @
new read-write snapshot from original @
would be created. With reboot router would boot to old version of system while new one would be now old savepoint snapshot. commit
operation would do flip of new and old root back. That means that with commit savepoint snapshot would become old version of system and current root would become again @
. It might be beneficial to instead of introducing just savepoint
snapshot type to introduce two new types instead. savepoint
for the committed save point and something like savepoint-rollback
for original root that was not committed and rollback with reboot occurred because of that.