From patchwork Fri Aug 30 09:42:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wido den Hollander X-Patchwork-Id: 2851842 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 046DB9F2F4 for ; Fri, 30 Aug 2013 09:42:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D82E201BA for ; Fri, 30 Aug 2013 09:42:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80D7020189 for ; Fri, 30 Aug 2013 09:42:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754644Ab3H3Jmy (ORCPT ); Fri, 30 Aug 2013 05:42:54 -0400 Received: from websrv.42on.com ([31.25.102.167]:57818 "EHLO websrv.42on.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754632Ab3H3Jmx (ORCPT ); Fri, 30 Aug 2013 05:42:53 -0400 Received: from [192.168.6.54] (cable-95-86.zeelandnet.nl [82.176.95.86]) by websrv.42on.com (Postfix) with ESMTPSA id CC07DC06EA; Fri, 30 Aug 2013 11:42:51 +0200 (CEST) Message-ID: <5220691A.1080604@42on.com> Date: Fri, 30 Aug 2013 11:42:50 +0200 From: Wido den Hollander User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" , Josh Durgin Subject: libvirt: Using rbd_create3 to create format 2 images Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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? From 2731f7c131d938ed5029bf8343877fcc4d950a0f 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 | 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