]> xenbits.xensource.com Git - libvirt.git/commit
rbd: Implement buildVolFrom using RBD cloning
authorWido den Hollander <wido@widodh.nl>
Wed, 27 Jan 2016 10:20:09 +0000 (11:20 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 29 Jan 2016 16:11:51 +0000 (11:11 -0500)
commit0b15f92032725a7943df1f035b649f4e030953e7
tree58fa815c4e2ae5e17dbd836703bfab050aca0088
parent34872ca4619fc97984e8cd7797a1ae91593b091f
rbd: Implement buildVolFrom using RBD cloning

RBD supports cloning by creating a snapshot, protecting it and create
a child image based on that snapshot afterwards.

The RBD storage driver will try to find a snapshot with zero deltas between
the current state of the original volume and the snapshot.

If such a snapshot is found a clone/child image will be created using
the rbd_clone2() function from librbd.

rbd_clone2() is available in librbd since Ceph version Dumpling (0.67) which
dates back to August 2013.

It will use the same features, strip size and stripe count as the parent image.

This implementation will only create a single snapshot on the parent image if
never changes. This reduces the amount of snapshots created for that RBD image
which benefits the performance of the Ceph cluster.

During build the decision will be made to use either rbd_diff_iterate() or
rbd_diff_iterate2().

The latter is faster, but only available on Ceph versions after 0.94 (Hammer).

Cloning is only supported if RBD format 2 is used. All images created by libvirt
are already format 2.

If a RBD format 1 image is used as the original volume the backend will report
a VIR_ERR_OPERATION_UNSUPPORTED error.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
src/storage/storage_backend_rbd.c