VirtualBox

Ticket #5393 (closed defect: wontfix)

Opened 4 years ago

Last modified 4 years ago

'Discard Current Snapshot and State' sometimes copies current state into a base hard disk rather than disards it

Reported by: MarkCranness Owned by:
Priority: major Component: other
Version: VirtualBox 3.0.10 Keywords: Snapshot, Discard, Revert
Cc: Guest type: other
Host type: other

Description

'Discard Current Snapshot and State' sometimes copies the current state into a base hard disk, Confirming/Commiting/Saving the current state, rather than Reverting/Discarding the current state.

(Note: Please ignore my previous ticket re a similar issue: My thinking wasn't right: This one is a bug.)

1) To see this behaviour, perform the following steps:

  • Create a new empty VDI file 'DiskB', attach it to a VM, partition it, format it and detach it again (or use an available VDI file that is not currently attached to any VM, AND was never attached to any VM at the time any existing snapshot was made - this is important).
  • Choose or create a VM to perform the test. Ensure that the 'DiskB' VDI is not attached.
  • Take a new Snapshot on the VM 'Snapshot 1'.
  • Attach 'DiskB' to the VM, ensuring that there is NO blue cog icon to the left of the disk name (it will be attached as a Base disk and not via a differencing disk).
  • Boot the VM and create a file named 'Change 1.5' on both DiskB and another disk on the VM. (At this point, file 'Change 1.5' is in the base VDI for DiskB, but in the current state differencing disk for the other VM disk.)
  • Shutdown the VM.
  • Take another new Snapshot 'Snapshot 2'.
  • Boot the VM and create a file 'Change 2.5' on both DiskB and the other disk.
  • Shutdown the VM.
  • Select 'Current State' in the tree and mouse hover over 'Discard Current Snapshot and State' button. Note Status Bar explanatory text says: 'Discard the current snapshot and revert the machine to the state it had before the snapshot was taken'
  • Click 'Discard Current Snapshot and State' button. According to the status bar text, this should rollback the 'Change 2.5' change, but leave the 'Change 1.5' file, on both disks.
  • Re-attach DiskB to the VM and boot the VM.
  • Examine the contents of the disks. You will note that the other VM disk is missing both 'Change 1.5' and 'Change 2.5' files, whereas it should still have 'Change 1.5' (which was the original problem reported at the head of this ticket).

You will also note that DiskB still has 'Change 2.5' on it, as it has been commited/merged into it. DiskB should only have 'Change 1.5' on it. This is a severe error.

2) The cause is that SessionMachine::discardCurrentStateHandler should never in any circumstances first Discard the current snapshot and then Revert the current state, as it currently does when there is more than one snaphot, because a Discard operation has the possibility (demonstrated above) of merging changes into the base hard disk.

It should instead (logically) Revert, then Discard (the now empty machine differencing disks), then Revert again. (Or probably have the first Revert not create new differencing disks anyway, then they won't need to be discarded.)

Change History

comment:1 Changed 4 years ago by MarkCranness

Oops. In the repro steps, replace the last step/comment with this: (deletions, additions)

  • Examine the contents of the disks. You will note that the other VM disk is missing both 'Change 1.5' and 'Change 2.5' files, whereas it should still have 'Change 1.5' (which was the original problem reported at the head of this ticket) This is working as designed, BUT NOTE is contrary to the status bar explanatory text.

You will also note that DiskB still has 'Change 2.5' on it, as it has been commited/merged into it. DiskB should only have 'Change 1.5' on it. This is a severe error.

comment:2 Changed 4 years ago by umoeller

  • Status changed from new to closed
  • Resolution set to wontfix

We have mostly rewritten the snapshot code for 3.1, whose beta will come out this week (please check the forums for announcements). There is little point for us to try and reproduce all this on the new code, so would you be so kind and test this again when the beta comes out?

I'm resolving this as "wontfix" for lack of a better option, but please don't be offended :-) If it's still broken please reopen.

comment:3 Changed 4 years ago by MarkCranness

No longer a problem in beta1. (The 'Discard Snapshot and State' button is not there anymore, so impossible to reproduce, which counts as fixed.)

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use