On 03/30/2010 05:26 PM, Eric Blake wrote:
On 03/30/2010 02:52 PM, Matthias Bolte wrote:
> 2010/3/30 Jiri Denemark <jdenemar(a)redhat.com>:
>> Hi.
>>
>> ...
>>> /* NOTE: struct _virDomainSnapshot is a private structure, ala
>>> * struct _virDomain.
>>> */
>>> typedef struct _virDomainSnapshot virDomainSnapshot;
>>>
>>> /* Take a snapshot of the current VM state. Throws an error if
>>> * the VM is not currently running */
>>> virDomainSnapshotPtr virDomainSnapshotCreateXML(virDomainPtr domain,
>>> const char *xmlDesc,
>>> unsigned int flags);
>>
>> This is probably a leftover from previous versions, but... why do we restrict
>> this API only for running VMs?
>>
>
> Yep, if a domain it not running you'll just get a disk snapshot
> without a memory snapshot.
Is taking a halted disk snapshot something we might want to allow with a
flag, though? For that matter, is this API useful for taking a disk
snapshot and disregarding a memory snapshot even of a running VM?
The problem with disgregarding a memory snapshot of a running guest is that it
is very easy to get inconsistent snapshots; that is, the guest could
have data cached in memory that is not on disk when you snapshot, and then you
have completely inconsistent results on disk.
ESX allows you to do a disk only snapshot of a running guest, but they cheat;
they also have a way to quiesce the guest (force writes), thus ensuring a
consistent snapshot.
Virtualbox doesn't give you a choice in the matter; if the guest is off when
you take a snapshot, you get a disk snapshot, and if it's on when you take a
snapshot, you get a disk+memory snapshot.
Qemu allows both usages, although it must have the consistency problems I
mentioned above for a disk-only snapshot on a running guest.
For now, I think we can stick with the disk-only semantic for shutoff guests,
and the disk+memory semantic for running guests. If it turns out that there
is a need for a disk-only semantic for running guests, this should be easy
to add later via a flag to virDomainSnapshotCreateXML.
--
Chris Lalancette