[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [FYI] Skript to extract qcow2 snapshot info to libvirt snapshot xml



On 10/20/2011 02:57 AM, Daniel P. Berrange wrote:
On Thu, Oct 20, 2011 at 08:50:35AM +0200, Philipp Hahn wrote:
Hello,

I sometimes get foreign qcow2 images with embedded snapshots. Without the
corresponding XML files libvirt doesn't recognize them. Therefor I created
the attached script to fake-create the missing snapshot XML files.
Be advised that the XML files might not work in all cases, especially when the
configuration was changed between snapshots, but at least I prefer a solution
working 95% of the times instead of 0% ;-)
And since I already wrote it, others might find it useful as well.

I wonder if we ought to put this in the libvirt source tree under
examples/ or something like that. Or turn it into a proper script
at tools/virt-qemu-import-snapshots ?

Or even add a flag or new API to the virDomainSnapshot family of commands to allow automating this as part of the API. The only drawback of parsing from qcow2 images is that you lack parent information, and none of the snapshots get marked current. Additionally, I already have pending on my plate a bug fix - right now, if any of the qcow2 files already contain an internal snapshot by a given name, or if you use a small integer name, like '1', which conflicts with qcow2 snapshot tag numbers, then you can inadvertently overwrite existing snapshots. So I _already_ have to fix the code to parse qemu-img output so as to add a safety check that any new internal snapshot name does not collide with any already-existing snapshot designations, and it won't be that much harder to turn that parsing into to something permanent.

But yes, thanks for the script, and I'll probably be referring to it in my snapshot improvements in some form or another (whether it remains an external script or becomes part of the internal libvirtd C code for the qemu driver).

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]