[libvirt-users] Virsh snapshots

Eric Blake eblake at redhat.com
Wed Dec 4 15:44:57 UTC 2013


On 12/04/2013 08:29 AM, Juraj Melo wrote:
> Thanks for your answer,

[please don't top-post on technical lists, and use proper in-reply-to
headers to keep things properly threaded]

> 
> I am trying to make a snapshot of whole virtual machine (disk, CPU
> state, memory). But I need to make this snapshot in matter of seconds.

This is possible using external snapshots with memory, present since
libvirt 1.0.5.  The overall operation takes as long as a migration to
file, but the guest continues to operate throughout that phase.  The
actual guest downtime is a mere fraction of a second at the point where
the disk snapshots are taken once the migration to file completed.

virsh snapshot-create-as $dom $snapname --live --memspec /path/to/file

will store the memory state into /path/to/file, and create an external
disk snapshot of each disk (you may need to use the --diskspec option if
you want to control the filenames of those disk snapshots).

> 
> I have already try to create snapshot of  disk, which is not problem. I
> use qcow2 format, and create new disk image using original disk image as
> backing file. But still I am not able to assign state of vm with new disk.
> 
> I have found some commands for creating snapshots in libvirt API, so in
> my opinion one way how to accomplish my task is to create utility using
> theese commands, and create snapshot of vm in RAM - I hope it would be
> faster.
> 
> But I wonder whether virsh contains similar functionality, so I won't
> need to programm it again.
> 

Yes, virsh wraps the virDomainSnapshotCreateXML() API.

-- 
Eric Blake   eblake 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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20131204/abd38395/attachment.sig>


More information about the libvirt-users mailing list