[libvirt] [Libvirt]Snapshot operations in Libvirt

Eric Blake eblake at redhat.com
Sat Feb 2 14:42:26 UTC 2013


On 02/02/2013 07:02 AM, harryxiyou wrote:
> Hi all,

[no need to cc me specifically, I read the list for a reason]
[no need to add "[Libvirt]" to your subject line, the list already adds
that automatically, making your messages come through with double tags:
https://www.redhat.com/archives/libvir-list/2013-February/thread.html#00072]

> 
> I see our libvirt snapshot XML form like following, which this
> XML is to create a disk snapshot of just vda on a qemu domain
> with two disks.
> 
> <domainsnapshot>
>   <description>Snapshot of OS install and updates</description>
>   <disks>
>     <disk name='/path/to/old'>
>       <source file='/path/to/new'/>
>     </disk>
>     <disk name='vdb' snapshot='no'/>
>   </disks>
> </domainsnapshot>
> 
> My understanding about up XML is like this: it creates a snapshot
> for '/path/to/old', which '/path/to/old' would be the read-only backing
> file to the new active file '/path/to/new'. I also have some questions
> about current libvirt snapshot operations like following.
> 
> 1, Is my up understanding right? Or maybe you have any other suggestions.

Yes, loading that snapshot XML with 'virsh snapshot-create $dom $file
--disk-only' while $dom is active would do what you describe, by using
the qemu 'blockdev-snapshot-sync' QMP command under the hood.

> 
> 2, I wonder whether libvirt *NOW* support start a snapshot and then
> mount this new storage block, which is based on the snapshot.
> Please give me some real examples (like Sheepdog volumes) if you
> can.

By default, that snapshot XML will create /path/to/new as a qcow2 file,
even if /path/to/old is a sheepdog volume.  I'm not very familiar with
sheepdog myself, but my impression is that sheepdog always forms the
base element of a stack as used by qemu - there's no way to make qemu
use a sheepdog volume that has /path/to/old as it's backing file with
qemu managing /path/to/old.  I don't know if sheepdog as a protocol
supports internal snapshots; but if it does, then we still need support
added to qemu to tell sheepdog to take an internal snapshot, then wiring
up support in libvirt to use that new qemu command.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130202/28100278/attachment-0001.sig>


More information about the libvir-list mailing list