[Libguestfs] [libvirt] Support for qemu snapshot=on drives in libvirt

Richard W.M. Jones rjones at redhat.com
Fri Oct 5 19:38:41 UTC 2012


On Fri, Oct 05, 2012 at 06:28:32AM -0600, Eric Blake wrote:
> On 10/05/2012 05:40 AM, Richard W.M. Jones wrote:
> > A simple implementation therefore would be to add a <snapshot/>
> > element to <disk>.  It would just add snapshot=on and ignore concerns
> > about $TMPDIR.
> > 
> > Or reuse the <readonly/> flag?  Note that these disks are writable.
> 
> The <transient/> tag sounds better than a new <snapshot/> tag or abuse
> of the <readonly/> tag.
[...]
> Ah, so making <transient> take optional attributes (and/or subelements)
> to further refine HOW the temporary file is created; but if not present,
> then libvirt defaults to as sane as possible.

Actually, libvirt(d) is not sane at the moment.  It picks the $TMPDIR
that happens to have been in the environment when virConnectOpen was
first called, and uses it for all following calls until libvirtd is
restarted.  (However you can override this using <qemu:env> although
apparently we shouldn't do that).

This especially matters for libguestfs non-root tests, because we set
$TMPDIR and old $TMPDIR's get deleted which used to cause qemu to fail
to start, until I started to use <qemu:env>.

> Existing libvirt has a way to create qcow2 files within a storage pool,
> but does so by calling out to qemu-img.  As for why qcow2 creation is
> slow, I don't know what we can do about it.

I'll take a look at why qemu-img is so slow.  Half a second isn't
acceptable.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list