From 68e212483a43196626413f2e487e2d6bb9c69726 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Fri, 30 Aug 2013 10:50:25 +0200 Subject: [PATCH] rbd: Use rbd_create3 to create RBD format 2 images by default This new RBD format supports snapshotting and cloning. By having libvirt create images in format 2 end-users of the created images can benefit of the new RBD format. Signed-off-by: Wido den Hollander --- src/storage/storage_backend_rbd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index d9e1789..2d4edc2 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -443,6 +443,11 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn, ptr.cluster = NULL; ptr.ioctx = NULL; int order = 0; + #if LIBRBD_VERSION_CODE > 259 + uint64_t features = 3; + uint64_t stripe_count = 1; + uint64_t stripe_unit = 4194304; + #endif int ret = -1; VIR_DEBUG("Creating RBD image %s/%s with size %llu", @@ -467,7 +472,12 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn, goto cleanup; } + #if LIBRBD_VERSION_CODE > 259 + if (rbd_create3(ptr.ioctx, vol->name, vol->capacity, features, &order, + stripe_count, stripe_unit) < 0) { + #else if (rbd_create(ptr.ioctx, vol->name, vol->capacity, &order) < 0) { + #endif virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create volume '%s/%s'"), pool->def->source.name, -- 1.7.9.5