Skip to content

Commit

Permalink
Merge pull request #3363 from canonical/fix-snapshot-restore-rollback
Browse files Browse the repository at this point in the history
[snapshots] Fix restore rollback
  • Loading branch information
Chris Townsend committed Jan 29, 2024
1 parent ef361f9 commit 1bd4b63
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/platform/backends/shared/base_virtual_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 506,6 @@ void BaseVirtualMachine::restore_rollback_helper(const Path& head_path,
VMSpecs& specs)
{
// best effort only
old_head->apply();
specs = old_specs;
if (old_head != head_snapshot)
{
Expand All @@ -524,8 523,6 @@ void BaseVirtualMachine::restore_snapshot(const std::string& name, VMSpecs& spec
assert_vm_stopped(state); // precondition
assert_vm_stopped(snapshot->get_state()); // precondition

snapshot->apply();

const auto head_path = derive_head_path(instance_dir);
auto rollback = make_restore_rollback(head_path, specs);

Expand All @@ -542,6 539,7 @@ void BaseVirtualMachine::restore_snapshot(const std::string& name, VMSpecs& spec
persist_head_snapshot_index(head_path);
}

snapshot->apply();
rollback.dismiss();
}

Expand Down

0 comments on commit 1bd4b63

Please sign in to comment.