[libvirt] libvirt + kvm external snapshots: use case?

Kashyap Chamarthy kchamart at redhat.com
Sun Jul 29 12:38:30 UTC 2012


On 07/16/2012 01:33 AM, Cole Robinson wrote:
> Forgive my ignorance, but I'm trying to fill in some details for a Fedora
> feature page:
> 
> https://fedoraproject.org/w/index.php?title=Features/Virt_Live_Snapshots
> 
> Yet things aren't working quite as expected in my tests. I'm trying to think
> of this from an end user use case perspective. For example
> 
> - I want to test some changes to my vm, and either throw them away, or commit
> them to my base disk image.
> - I want to have a base disk image, but have multiple snapshots with various
> mutually exclusive VM changes in each, like one snapshot with libvirt 0.7.0
> installed, another with 0.8.0 installed. I want to switch between them
> 
> (maybe those assumptions are off base to begin with)
> 
> So for a running guest, I do:
> 
> virsh snapshot-create-as myvm snapshot1 "snapshot1 description" --disk-only
> virsh snapshot-create-as myvm snapshot2 "snapshot2 description" --disk-only


Another possible way is to specify the device name explicitly using --diskspec

=====================================================================
root@~$ virsh domblklist f17test --details
Type       Device     Target     Source
------------------------------------------------
file       disk       vda        /var/lib/libvirt/images/f17test.qcow2
=====================================================================
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@~$
=====================================================================

> 
> I make some changes that I want to discard, so I try and switch back to the
> older vm and want to switch back to an older snapshot state, odo:
> 
>   virsh snapshot-revert myvm snapshot1
> 
> But I get: 'revert to external disk snapshot not supported yet'. Hmm, that
> kind of invalidates all my use cases then. Additionally I don't see any API
> option for merging snapshots, to fold my changes in snapshot2 into parent
> snapshot1 or similar. I tried using snapshot-delete, but that also fails with
> external disk snapshots: 'deletion of 1 external disk snapshots not supported yet'
> 
> Additionally, there's the --atomic option to snapshot-create-as, but it fails
> for guests with more than 1 snapshotable disks: 'atomic live snapshot of
> multiple disks is unsupported'. But isn't that what some of the recent qemu
> additions explicitly supposed to support (that's the impression I got from jtc)?
> 
> So am I missing anything? If not, are things just not fully wired up or are
> there missing chunks of functionality? And what's the use case for the current
> impl of disk snapshoting (while I've read around and found lot's of info about
> the implementation side of things, not too much about intended uses)?

>From a previous discussion with Eric, with external snapshots the ‘original qcow2 file’
will be in a ‘read-only’ saved state, and the new qcow2 file(which will be generated once
snapshot is created) will be the *delta* for the changes. So, all the changes will now be
written to this delta file. External Snapshots appear to be useful for performing
backups(though I'm yet to try those). Also, external snapshot creates a qcow2 file with
the original file as its backing image, and the backing file can be /read/ in parallel
with the running qemu.

(side note: though, if we're not using --disk-only, then offline snapshots appear to be
faster.)

I'm also currently trying out different possibilities of external snapshots and trying to
explore and understand proper use-cases. I'd be curious to hear more on this.  I'll will
post my notes and participate in the above test day.

Here's a slightly old blog post I made w/ snapshots -
kashyapc.wordpress.com/2011/10/04/snapshotting-with-libvirt-for-qcow2-images/

> 
> Thanks,
> Cole
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 


-- 
/kashyap





More information about the libvir-list mailing list