
On 05/17/2012 11:00 PM, Eric Blake wrote:
On 05/14/2012 11:26 PM, Kashyap Chamarthy wrote:
Hi,
I'm willing to test/understand snapshotting in libivrt/qemu in a much better way. I can spend 10-ish hours or so a week.
I see a lot of work going on the snapshot front, upstream qemu/libvirt. I'm currently following/reading: ---------- http://wiki.qemu.org/Features/SnapshotsMultipleDevices http://wiki.qemu.org/Features/LiveBlockMigration
This documents the lower-level commands exposed by qemu, but not necessarily how libvirt uses them.
I made that page prior to integrating the code for live disk snapshots, but have not maintained it since, so it might be a bit out of date with how things have changed in the meantime, but hopefully still relatively accurate.
That page is live based on libvirt.git, and should be up-to-date with the current implementation; although I would welcome improvements for additional things to mention.
I'd probably like to add some examples there for each different variant of snapshots just to give a practical idea for people referring that page. I'll try to do this over the weekend. You mentioned this page is live based on libvirt.git. Can I manually edit the examples section? Just ensuring I'm not messing up around.
------------
Am I going the right way?
Once I get a decent hang of things, I was wondering I could start writing some tests.
What do you advice?
Do you have specific scenarios in mind? Propose a problem that you think a snapshot would help, then ask questions on which APIs you would use to solve that problem.
Nothing specific in mind. Let me see if I can provide a bit more info. I'm testing snapshots in the context of working with FreeIPA project, where I have a test set-up w/ multiple guests, with subtle env. changes in them, interacting w/ each other. I need keep track of a clean state, a state with a particular env set-up, revert to a certain state, etc, often ending up with a tree of (internal)snapshots for each guest. I'm just exploring what kind of snapshots are most efficient for these scenarios.
Do you understand the difference between the various snapshot flavors? There's several orthogonal issues to be aware of, although not all combinations are supported.
I think I do understand to a certain extent. I previously had a discussion with you when I initially started off and captured the notes as a blog post -- http://kashyapc.wordpress.com/2011/10/04/snapshotting-with-libvirt-for-qcow2... However, thanks for the nice summary below.
system checkpoint: VM state and disk state 'virsh snapshot-create' disk only: just disk state 'virsh snapshot-create --disk-only' VM state only: 'virsh save' - I'd really like to make this a special case of 'virsh snapshot-create', but it needs more work
online: taken from a running VM offline: taken from an offline VM live: online, plus the additional guideline that the VM continues running after the snapshot is taken, preferably with minimum downtime
internal: requires qcow2, qemu stores VM state and disk state inside the qcow2 image, libvirt stores only an xml file tracking the state relation (qemu 'savevm' command) external: create a new file, possible for VM state (qemu 'migrate' to file) and disks (qemu 'transaction:blockdev-snapshot-sync')
I'm sure additional tests would be welcome; perhaps libvirt-TCK would be a good place to add such tests. But I'm not quite sure what you plan to do, or which aspects you plan to test, without more details; I'll try to be responsive to any questions you have regarding specifics of any sequence you are trying to do.
I'll post more when I have a bit more clarity and more specifics on what I'd like to try. I'm a little hazy with the external snapshots as the combinations/tree of snapshots can get a bit complex . Though I do use the basic operation in my daily work flow, like: ===================== root@~$ virsh list Id Name State ---------------------------------------------------- 11 f17test running root@~$ ===================== root@~$ virsh domblklist f17test --details Type Device Target Source ------------------------------------------------ file disk vda /var/lib/libvirt/images/f17test.qcow2 root@~$ ===================== root@~$ virsh snapshot-create-as f17test cleanf17 cleanf17-box --diskspec vda,file=/var/lib/libvirt/images/snap-f17test.qcow2 --disk-only Domain snapshot cleanf17 created root@~$ ===================== root@~$ virsh snapshot-list f17test Name Creation Time State ------------------------------------------------------------ cleanf17 2012-05-14 00:02:54 +0530 disk-snapshot root@~$ ===================== Thanks for your response. -- /kashyap