[libvirt] question about save/restore domain

Jovanka Gulicoska jovanka.gulicoska at gmail.com
Tue Jul 3 17:35:10 UTC 2012


On Tue, Jul 3, 2012 at 6:01 PM, Eric Blake <eblake at redhat.com> wrote:
>
> 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.

This is in the draft of the documentation:
http://libvirt.org/guide/html-single/#Application_Development_Guide-Lifecycle-Save
--- "For basic usage this implies that a guest can only be restored
once from any given saved state image."

> 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).

I've also created bindings for virDomainRestore and
virDomainManagedSave is already implemented.

> > 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.
>

I understood this and I've also implemented it.

> > 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?

The main idea is to allow the user to save the virtual machine and be
able to load it when he wants and be able to share it with others who
uses Boxes, so the other person can also load it on his machine (in
Boxes).
I was not sure which patches to include to the review and which
functions should I use in Boxes. I'm testing this now.

> > 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
> them.
>

Thanks for your response. And please correct me if I misunderstood something.

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




More information about the libvir-list mailing list