Thanks a lot Eric for taking the time to write such an in-depth reply!

Kind Regards

Chris


On Mon, Mar 17, 2014 at 6:06 PM, Eric Blake <eblake@redhat.com> wrote:
On 03/17/2014 11:51 AM, chris 0 wrote:
> Hi,
>
> I'm just wondering is there any way for me to trigger KVM's
> -snapshot parameter from libvirt.

We do NOT want to expose qemu's -snapshot parameter directly via
libvirt, for several reasons:

1. it makes qemu use $TMPDIR, and on systems where $TMPDIR defaults to
/tmp and where /tmp is not backed by disk, it can easily exhaust space
limits in /tmp

2. -snapshot mode makes a guest non-migrateable

3. -snapshot is incompatible with sVirt SELinux labeling, because qemu
ends up creating the file, but under sVirt rules, qemu is only allowed
to use pre-existing pre-labeled files

However, we DO plan on supporting transient disks (which is the
underlying operation being provided by -snapshot mode), just by doing
the work ourselves instead of letting qemu do it (that is, we'd create
our OWN qcow2 wrapper, pass that to qemu, and then tear down the wrapper
when the guest exits).  In fact, we already designed the XML for it
(under any <disk> that you want to be in snapshot mode, add a
<transient/> tag) - we just haven't wired it up for qemu guests yet.  To
do that, we need to track the FULL backing chain in use by any domain,
and _that's_ something that I'm actively working on.  We'd also like to
have a way to associate a storage pool per domain, so that actions that
carve out what may be a large file will do so in the appropriate
location; I'm not sure if anyone is currently working on coding this,
although the idea has been around on the list for a while, and I'm more
than willing to give design pointers to whoever tackles it.

For more background, see https://bugzilla.redhat.com/show_bug.cgi?id=832194

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org