2010/3/29 Chris Lalancette <clalance(a)redhat.com>:
Hey Mattias,
I'm currently working on the semantics of
virDomainSnapshotDelete(), which has been renamed from
the earlier virDomainSnapshotDeactivate(). In qemu/kvm,
it seems like it is possible to delete a snapshot at any
time, even while that snapshot is running (though I'm not
yet sure exactly what happens in that case). Talking
to Jirka, it seems like the virtualbox GUI doesn't allow you to
do any operations at all on snapshots while a domain is running,
although we don't know yet if this is a restriction in the
API as well.
My questions for you are about how ESX handles this situation:
1) Can you manipulate a domain's snapshots while that domain is
running?
Yes, ESX allows to freely delete snapshots and switch between them
while the domain is running.
2) If so, can you delete the snapshot that is currently running?
If so, what happens?
Yes, ESX allows to delete any snapshot at any time, no restrictions.
For example
base -> A -> B -> C -> current state
C is the snapshot "that is currently running". If I delete C it gets
merged into its parent B
base -> A -> B ------> current state
and everything is fine.
I tested this and some other scenarios, everything works as expected.
Some words about the MERGE and DISCARD flags for virDomainSnapshotDelete:
ESX has RemoveSnapshot and RevertToSnapshot functions. RemoveSnapshot
merges a snapshot into its parent, so the MERGE flag is simple. In
order to DISCARD a snapshot, you need to go back to it first using
RevertToSnapshot and then discard it and its children (if any) using
RemoveSnapshot.
A minor problem here is that RevertToSnapshot may start the domain if
the domain was running at the time the snapshot was created. With ESX4
VMware added a flag to the RevertToSnapshot function to suppress a
possible strat of the domain.
Matthias