[libvirt] RFCv2: virDomainSnapshotCreateXML enhancements

Stefan Hajnoczi stefanha at gmail.com
Tue Aug 23 15:12:00 UTC 2011


On Tue, Aug 23, 2011 at 2:48 PM, Eric Blake <eblake at redhat.com> wrote:
> On 08/23/2011 04:28 AM, Stefan Hajnoczi wrote:
>>
>> I forgot to ask the obvious question:
>>
>> I am writing a backup program that is using the new snapshot APIs.  A
>> snapshot has been created, how do I read out the data from the
>> snapshot?
>
> Here's how to access the data in the snapshot, at least for the first round
> implementation of qcow2 snapshots:
>
> If you created an internal snapshot (virDomainSnapshotCreateXML with no
> flags), then the only way right now to read data out is to shut down any
> qemu process (since qemu-img should not be used on a file in active use by
> qemu), then:
> qemu-img convert [options] -s snapshot file backup
> to extract the named internal snapshot from 'file' into a new file 'backup'.
>
> If you created an external snapshot (virDomainSnapshotCreateXML with the new
> _DISK_ONLY flag), then the data from the snapshot is the old file name.
>  That is, if you start with '/path/to/old', then create a snapshot with a
> target file of '/path/to/new', then /path/to/old _is_ the snapshot, and
> /path/to/new is a qcow2 file with /path/to/old as its backing file.  The
> snapshot (old file) can safely be accessed even while qemu is still running.

Hmm...so there is no abstraction.  I still need to understand what the
underlying snapshot implementation does and what its limitations are.

This is what I meant when I asked about aiming for something more
high-level where the user doesn't need to be an expert in snapshots to
use this API.  In order to access the snapshot I need to use an
out-of-band (ssh?) mechanism to get to the libvirt host and know how
to access the external snapshot image file.  If that image file is
using an image format then I need to use libguestfs, qemu-io/qemu-img,
or custom code to access the format.

I think we simply cannot expose all this complexity to users.  Each
application would have to support the many different cases.  Libvirt
needs to tie this stuff together and present an interface that
applications can use without worrying how to actually get at the
snapshot data.

Stefan




More information about the libvir-list mailing list