All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wido den Hollander <wido@42on.com>
To: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	Josh Durgin <josh.durgin@inktank.com>
Subject: libvirt: Using rbd_create3 to create format 2 images
Date: Fri, 30 Aug 2013 11:42:50 +0200	[thread overview]
Message-ID: <5220691A.1080604@42on.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

Hi,

I created the attached patch to have libvirt create images with format 2 
by default, this would simplify the CloudStack code and could also help 
other projects.

The problem with libvirt is that there is no mechanism to supply 
information like order, features, stripe unit and count to the 
rbd_create3 method, so it's now hardcoded in libvirt.

Any comments on this patch before I fire it of to the libvirt guys?

-- 
Wido den Hollander
42on B.V.

Phone: +31 (0)20 700 9902
Skype: contact42on

[-- Attachment #2: 0001-rbd-Use-rbd_create3-to-create-RBD-format-2-images-by.patch --]
[-- Type: text/x-patch, Size: 1557 bytes --]

From 2731f7c131d938ed5029bf8343877fcc4d950a0f Mon Sep 17 00:00:00 2001
From: Wido den Hollander <wido@widodh.nl>
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 <wido@widodh.nl>
---
 src/storage/storage_backend_rbd.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index d9e1789..e5d720e 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -443,6 +443,9 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn,
     ptr.cluster = NULL;
     ptr.ioctx = NULL;
     int order = 0;
+    uint64_t features = 3;
+    uint64_t stripe_count = 1;
+    uint64_t stripe_unit = 4194304;
     int ret = -1;
 
     VIR_DEBUG("Creating RBD image %s/%s with size %llu",
@@ -467,7 +470,8 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (rbd_create(ptr.ioctx, vol->name, vol->capacity, &order) < 0) {
+    if (rbd_create3(ptr.ioctx, vol->name, vol->capacity, features, &order,
+                    stripe_count, stripe_unit) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("failed to create volume '%s/%s'"),
                        pool->def->source.name,
-- 
1.7.9.5


             reply	other threads:[~2013-08-30  9:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  9:42 Wido den Hollander [this message]
2013-08-30 15:26 ` libvirt: Using rbd_create3 to create format 2 images Josh Durgin
2013-08-30 18:38   ` Wido den Hollander
2013-09-02 14:58     ` Wido den Hollander
2013-09-03 18:23       ` Josh Durgin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5220691A.1080604@42on.com \
    --to=wido@42on.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=josh.durgin@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.