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

[snapshots] Rollback of failed restore wrongly applies last snapshot #3362

Closed
ricab opened this issue Jan 9, 2024 · 0 comments · Fixed by #3363
Closed

[snapshots] Rollback of failed restore wrongly applies last snapshot #3362

ricab opened this issue Jan 9, 2024 · 0 comments · Fixed by #3363
Assignees
Labels
Milestone

Comments

@ricab
Copy link
Collaborator

ricab commented Jan 9, 2024

When rolling back a failed restore, we wrongly apply the last snapshot. But it is likely that there had been changes since it was last taken/applied.

$ multipass launch --name gentle-beetle
Launched: gentle-beetle
$ multipass stop gentle-beetle
$ multipass snapshot gentle-beetle
Snapshot taken: gentle-beetle.snapshot1
$ multipass snapshot gentle-beetle
Snapshot taken: gentle-beetle.snapshot2
$ multipass exec gentle-beetle -- touch asdf
$ multipass stop gentle-beetle
$ sudo chattr  i /root/.local/share/multipassd/vault/instances/gentle-beetle/snapshot-head
$ multipass restore --destructive gentle-beetle.snapshot1
[2024-01-09T18:34:33.890] [error] [gentle-beetle] Caught an unhandled exception: failed to open file '/root/.local/share/multipassd/vault/instances/gentle-beetle/snapshot-head' for writing
restore failed: failed to open file '/root/.local/share/multipassd/vault/instances/gentle-beetle/snapshot-head' for writing
$ multipass exec gentle-beetle -- ls
$ # nothing

To make snapshot-head editable again:

$ sudo chattr -i /root/.local/share/multipassd/vault/instances/gentle-beetle/snapshot-head
@ricab ricab added the bug label Jan 9, 2024
@ricab ricab self-assigned this Jan 9, 2024
ricab added a commit that referenced this issue Jan 9, 2024
Stop applying the last snapshot when rolling back a failed snapshot
restore. Instead, apply the intended snapshot only after every other
restore step has succeeded, thereby dispensing with rolling back the
apply step itself (as long as it is itself transactional). Fixes #3362.
@townsend2010 townsend2010 added this to the 1.13.1 milestone Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants