Skip to content

Commit 1bd4b63

Browse files
author
Chris Townsend
committed
Merge pull request #3363 from canonical/fix-snapshot-restore-rollback
[snapshots] Fix restore rollback
1 parent ef361f9 commit 1bd4b63

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/platform/backends/shared/base_virtual_machine.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ void BaseVirtualMachine::restore_rollback_helper(const Path& head_path,
506506
VMSpecs& specs)
507507
{
508508
// best effort only
509-
old_head->apply();
510509
specs = old_specs;
511510
if (old_head != head_snapshot)
512511
{
@@ -524,8 +523,6 @@ void BaseVirtualMachine::restore_snapshot(const std::string& name, VMSpecs& spec
524523
assert_vm_stopped(state); // precondition
525524
assert_vm_stopped(snapshot->get_state()); // precondition
526525

527-
snapshot->apply();
528-
529526
const auto head_path = derive_head_path(instance_dir);
530527
auto rollback = make_restore_rollback(head_path, specs);
531528

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

542+
snapshot->apply();
545543
rollback.dismiss();
546544
}
547545

0 commit comments

Comments
 (0)