[libvirt] QEMU/KVM snapshots, and rudimentary API extension

Cole Robinson crobinso at redhat.com
Fri Jan 8 20:49:59 UTC 2010

On 12/31/2009 07:42 PM, Philip Jameson wrote:
> I was starting to use libvirt on a project, and realized that there was nothing in the API for snapshots. As I need to be able to take snapshots without taking down the machine (that and KVM's restore function didn't seem to be working terribly well), I added a few functions so that I could take snapshots, and I also added a screenshot function so I could give users a view of their snapshots in my application. At this point, as I only really use KVM/QEMU, that is the only hypervisor I implemented it for, and I'm sure there will be some problems with my structure in the other drivers. However, I figured I should at least submit the patch, even if it turns out to be of no use to anyone :)
> At this point for the QEMU driver, it only does snapshots for qcow2 drives, and will report an error if qemu says that no valid drives were found, or if for restoring/deleting the specified snapshot wasn't found.

Hi Philip,

Thanks for the patch, snapshot handling is definitely one of the big
missing pieces in libvirt. For this patch to get better attention, I'd
recommend making a top level post (for some reason this mail appeared as
a reply to an unrelated thread), and split the patch into discreet
parts. You can see an example of such a split at
http://libvirt.org/api_extension.html. Using git send-email will make
this process very easy.

It's probably also a good idea to split the screenshot API from the
snapshot pieces and submit them separately.

FYI, Dan (the primary libvirt architect) did a write up a while ago
describing what he thought a snapshotting API should look like:


It's pretty similar to yours: it might help to adjust your API entry
points to take into account Dan's ideas.

Thanks for the contribution!

- Cole

More information about the libvir-list mailing list