[libvirt] [PATCH] rbd: Use rbd_create3 to create RBD format 2 images by default

Daniel P. Berrange berrange at redhat.com
Tue Feb 11 12:13:18 UTC 2014


On Thu, Jan 30, 2014 at 03:19:11PM +0100, Wido den Hollander wrote:
> This new RBD format supports snapshotting and cloning. By having
> libvirt create images in format 2 end-users of the created images
> can benefit from the new RBD format.
> 
> Older versions of libvirt can work with this new RBD format as long
> as librbd supports format 2. RBD format is supported by librbd since
> version 0.56 (Ceph Bobtail).
> 
> Signed-off-by: Wido den Hollander <wido at widodh.nl>
> ---
>  src/storage/storage_backend_rbd.c |   22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
> index c5f0bc5..91c07ac 100644
> --- a/src/storage/storage_backend_rbd.c
> +++ b/src/storage/storage_backend_rbd.c
> @@ -458,6 +458,25 @@ virStorageBackendRBDCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
>      return 0;
>  }
>  
> +static int virStorageBackendRBDCreateImage(rados_ioctx_t io,
> +                                           char *name, long capacity)
> +{
> +    int order = 0;
> +    #if LIBRBD_VERSION_CODE > 260
> +    uint64_t features = 3;
> +    uint64_t stripe_count = 1;
> +    uint64_t stripe_unit = 4194304;
> +
> +    if (rbd_create3(io, name, capacity, features, &order,
> +                    stripe_count, stripe_unit) < 0) {
> +    #else
> +    if (rbd_create(io, name, capacity, &order) < 0) {
> +    #endif

The '#if' indentation violates style rules - please remember
to run 'make syntax-check' before submitting.


ACK and I've pushed with the indentation fix

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list