Thanks for your answer, 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. 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. Dne 2.12.2013 19:32, Eric Blake napsal(a): On 12/02/2013 09:04 AM, Juraj Melo wrote:> Hello, > > I am working on my PhD thesis and it would be really helpfull if someone > could advise me, whether can Virsh create snapshots of VMs using > copy-on-write.What are you trying to copy-on-write? Is it just disk state, or VM memory state? Do you have corresponding qemu commands that you are trying to figure out if virsh maps to those same commands? There's a lot of flexibility in the virsh snapshot XML, but not all of it has been wired up yet (in part because it's still a moving target for what upstream qemu supports), so knowing more details about what you are trying to do will help us better answer whether it can be done now and if so with which commands.
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
On 12/04/2013 04:44 PM, Eric Blake wrote:> 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).A simple test of what Eric described is here: http://kashyapc.fedorapeople.org/virt/external-system-checkpoint-snapshot.txt> >> >> 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. > > > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users >-- /kashyap