[libvirt] RFC: using a network device as a destination for a disk snapshot

Eric Blake eblake at redhat.com
Wed Oct 30 14:44:32 UTC 2013


Right now, when creating an external snapshot, the snapshot xml requires
that the destination be in the local file system:

http://libvirt.org/formatsnapshot.html

<domainsnapshot>
  ...
  <disks>
    <disk name='vda' snapshot='external'>
      <driver type='qcow2'/>
      <source file='/path/to/new'/>
    </disk>
...

But libvirt already allows for a network device with qcow2 contents,
provided that there is no backing chain:

# qemu-img info gluster://red/vol1/img2
image: gluster://red/vol1/img2
file format: qcow2
virtual size: 10M (10485760 bytes)
disk size: 193K
cluster_size: 65536
# virsh dumpxml dom
<domain type='kvm'>
  ...
    <disk type='network' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source protocol='gluster' name='vol1/img2'>
        <host name='red'/>
      </source>
      <target dev='vdc' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x0'/>
    </disk>
...

I'm working on patches to the backing chain code to allow a gluster (or
other network device) with qcow2 contents to have a backing file, but
for the code to be useful, we also need to patch <domainsnapshot> xml to
allow the destination file to be a gluster or other network device,
rather than forcing it to be a local file name.

Here's the XML I think we need to add to domainsnapshot:

<domainsnapshot>
  ...
  <disks>
    <disk name='vda' snapshot='external' type='network'>
      <driver type='qcow2'/>
      <source protocol='gluster' name='vol1/img2'>
        <host name='red'/>
      </source>
    </disk>

that is, add an optional /disk at type attribute (if absent, it defaults to
type='file'), and where if present, the <source> subelement then takes
on alternate forms in the same manner in which //domain/devices/disk
handles alternates (here, allowing a protocol, name, and host
specification).

[Ultimately, we need to fix //domain/devices/disk to specify a full
backing chain, but one step at a time...]

-- 
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/20131030/4711318c/attachment-0001.sig>


More information about the libvir-list mailing list