[libvirt] question about save/restore domain

Eric Blake eblake at redhat.com
Tue Jul 3 16:01:02 UTC 2012

On 07/03/2012 06:42 AM, Jovanka Gulicoska wrote:
> Hi,
> my name is Jovanka Gulicoska and I'm SoC student. I'm working on
> implementing save/load of VM in Gnome-Boxes.
> Something confused me about snapshots. In the documentation about life
> cycle, in section about Save/Restore is said that domain saved with
> virDomainSave/virDomainSaveFlags can be restored only once.

Can you point out the URL to that documentation?  It's slightly
incorrect, and worth patching to make clearer if that would help the
next person to read them.

virDomainRestore can be used to restore a domain as many times as you
want, _provided_ that before each restore, you _manually_ restore the
disk state back to what it was at the time of the virDomainSave.

virDomainManagedSave uses virDomainSave under the hood to create a save
image which is then autoloaded at the next virDomainStart, but because
it is auto-managed, it can only be restored once (on restoring a
managedsave domain, the managed state is discarded).

> But in the
> documentation about Snapshot XML format there is no information about this
> in VM state snapshots.

virDomainSnapshotCreateXML is able to create a system checkpoint of both
disk and RAM state at once, such that virDomainSnapshotRevert then
restores disk state and memory state in one operation, instead of
leaving the disk state to manual operation.

> So is it better just to use virDomainSnapshotCreateXML instead of
> virDomainSave/virDomainSaveFlags?

It all depends on what your end goal is with doing a save/load of a VM.
 Do you need fast saves, or is it okay if the save takes several
seconds?  Will you be loading the state exactly once, or do you plan to
make it something that the user can revert to multiple times in a row?

> I've created bindings for this functions in libvirt-glib but I wanted to be
> sure before I send them for review.

Feel free to ask more questions on the topic; I'll do my best to answer

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120703/1a36cdb3/attachment-0001.sig>

More information about the libvir-list mailing list