[libvirt] suggestions on snapshotting testing

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 http://wiki.libvirt.org/page/Snapshots http://libvirt.org/formatsnapshot.html ------------ 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? -- /kashyap

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.
------------
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. 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. 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. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

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

On 05/21/2012 02:59 AM, Kashyap Chamarthy wrote:
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.
The web page only updates when we push your changes to the upstream libvirt.git. You can play with your local copy of libvirt.git to your heart's content (and run 'make' then browse the local contents using a file:/// URL) all before posting your patch for review here, without worrying about what will happen to the upstream documentation. Part of the review process is making sure that your proposed html changes will make sense when they go live.
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.
offline system checkpoint snapshots (which is basically a form of internal disk snapshots) and online disk snapshots (external disk snapshots, no VM state) are the fastest to create; but it is easier to boot an offline system checkpoint (the disks are assumed to be in a stable state when the guest goes offline) compared to a disk snapshot (if you don't have a guest agent running to quiesce the guest I/O before taking the snapshot, then the resulting snapshot may require an fsck to be usable in the context of booting from that snapshot).
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.
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.
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/21/2012 10:54 PM, Eric Blake wrote:
On 05/21/2012 02:59 AM, Kashyap Chamarthy wrote:
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.
The web page only updates when we push your changes to the upstream libvirt.git. You can play with your local copy of libvirt.git to your heart's content (and run 'make' then browse the local contents using a file:/// URL) all before posting your patch for review here, without worrying about what will happen to the upstream documentation. Part of the review process is making sure that your proposed html changes will make sense when they go live.
Yeah I already have a local copy. Will post when I have detail. Thank you.
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.
offline system checkpoint snapshots (which is basically a form of internal disk snapshots) and online disk snapshots (external disk snapshots, no VM state) are the fastest to create; but it is easier to boot an offline system checkpoint (the disks are assumed to be in a stable state when the guest goes offline) compared to a disk snapshot (if you don't have a guest agent running to quiesce the guest I/O before taking the snapshot, then the resulting snapshot may require an fsck to be usable in the context of booting from that snapshot).
Yeah, I'm leaning towards on-line disk snapshots. (as I don't care much about VM state at the moment). Thanks again for the detail
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.
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
participants (2)
-
Eric Blake
-
Kashyap Chamarthy