From patchwork Thu Apr 11 10:50:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Garzarella X-Patchwork-Id: 10895783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32130139A for ; Thu, 11 Apr 2019 11:09:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C96428952 for ; Thu, 11 Apr 2019 11:09:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11335289A9; Thu, 11 Apr 2019 11:09:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8B8C28952 for ; Thu, 11 Apr 2019 11:09:13 +0000 (UTC) Received: from localhost ([127.0.0.1]:46543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEXZx-0008R6-3e for patchwork-qemu-devel@patchwork.kernel.org; Thu, 11 Apr 2019 07:09:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEXHu-0001lg-3q for qemu-devel@nongnu.org; Thu, 11 Apr 2019 06:50:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEXHt-0006fH-4h for qemu-devel@nongnu.org; Thu, 11 Apr 2019 06:50:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39289) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hEXHq-0006ZF-RO; Thu, 11 Apr 2019 06:50:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C136CAC08E; Thu, 11 Apr 2019 10:50:28 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-116-245.ams2.redhat.com [10.36.116.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39F1B1001E67; Thu, 11 Apr 2019 10:50:25 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Thu, 11 Apr 2019 12:50:24 +0200 Message-Id: <20190411105025.97397-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 11 Apr 2019 10:50:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 0/1] block/rbd: increase dynamically the image size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Josh Durgin , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP RBD APIs don't allow us to write more than the maximum size of the file set with rbd_create() or rbd_resize(), so we are not able to create/use a qcow2 image with the rbd driver. What I found is the following: - when qcow2 uses the rbd driver, the new file is created (rbd_create) with the size equals to 0. (qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) returns 0 in qemu_rbd_co_create_opts()) - the file is truncated (implemented with rbd_resize) to 0 before to write the qcow2 header. - the "size" parameter passed to rbd_create() or rbd_resize() is interpreted as the maximum size of the file, this means that all writes that exceed that size, fails and returns -22. As a workaround, I'm checking if the RW operations exceed the maximum size and then I'll resize the file. It works, but I'm not sure it is the right way. Any suggestions? Thanks, Stefano Stefano Garzarella (1): block/rbd: increase dynamically the image size block/rbd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)