[libvirt] question about save/restore domain

Eric Blake eblake at redhat.com
Tue Jul 3 18:18:57 UTC 2012


On 07/03/2012 11:35 AM, Jovanka Gulicoska wrote:
> 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."

Ah, and I think reading that sentence in context clarifies the situation:

"Thus when the guest is restored, the underlying guest storage must be
in exactly the same state as it was when the guest was initially saved.
For basic usage this implies that a guest can only be restored once from
any given saved state image. To allow a guest to be restored from the
same saved state multiple times, the application must also have taken a
snapshot of the guest storage at time of saving, and explicitly revert
to this storage snapshot when restoring."

Either you manually revert the storage back to match the save image
state before restoring, or you use things in a more basic manner (never
touch the storage manually, and therefore restore works only once
because the storage was unchanged between the save/restore cycle but is
now altered after the successful restore).

But you're still welcome to provide a patch; the source code for that
page can be found at this repo:
 http://libvirt.org/git/?p=libvirt-appdev-guide.git;a=summary

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

Letting _another_ person load the saved image sounds like some degree of
cloning.  Are you trying to clone from an offline state (in which case,
it is just as easy to create a new domain from XML pointing to the
cloned disks), or are you trying to clone from an online state (where
the other user gets to load the domain already booted to the point that
the first user had it)?  The former is already possible, the latter is
on my wishlist of cool things where it would be nice to add better
libvirt support.  Another thing to worry about with the feature request
of online cloning is what happens if the guest has saved state related
to the original (for example, dmidecode information in the guest can see
the UUID assigned by the host, but cloning implies creating a new domain
with a new UUID).

-- 
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/21431442/attachment-0001.sig>


More information about the libvir-list mailing list