From nobody Wed May 1 14:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598361637; cv=none; d=zohomail.com; s=zohoarc; b=P4JWFE7lenScQJlAO6fJtzURxRj8lhsQ6oi0/xTNvMwDnaTtrssq0fn4TBVALVJth0HJp2ukEcQzYmmFhRsawXmqLfExi677kh89YZBfgz0iyTMcrY/Gi8j87rr79YfWbsCVVa7RQqLG0w34Khdfez5MyKvXEw8e282k3io3ZXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598361637; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=2RAheX27nzm4Pn1seki664YYSLB6i+obhddomMDMhrQ=; b=oHgMxqI5MnE9YjxW2hXowVE/xoYSypC0Vr2w5L+mZLHUHOlB36P1vRJVf174KwfsjhFZsx6PxVww3g5xdDMaRTYtrFjm1hxuzz455nvCLIaQ8xCh1gOPDPZ9V6J541NA4keephr7RanLggaUniPcpyBaYOhUcPVgPHC+S6NJZwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1598361637159185.43250136376037; Tue, 25 Aug 2020 06:20:37 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-isWFQoZGM2a54BMp3IhX_Q-1; Tue, 25 Aug 2020 09:20:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11F7A18A226F; Tue, 25 Aug 2020 13:20:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E376A7D889; Tue, 25 Aug 2020 13:20:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7AF601826D2A; Tue, 25 Aug 2020 13:20:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07PDGlfF001162 for ; Tue, 25 Aug 2020 09:16:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id AC9CD5F707; Tue, 25 Aug 2020 13:16:47 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.193.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27AF75C1DA for ; Tue, 25 Aug 2020 13:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598361636; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2RAheX27nzm4Pn1seki664YYSLB6i+obhddomMDMhrQ=; b=aCZfsq9o156GR7R71+dCBzUKZDd4RU/2M8F8GIiW1dycdNPXlEddQy5YjbGye258Rdsm2X qdXglxbSX1kLc2tIkXiAiKBIaNJBNsSuIsmf1TKlrm/jBRRTqA7EPI46qtLmazWWz0MWag N76NZCJ19/+vtGEieP+BonuNksj6xOc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598361636; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2RAheX27nzm4Pn1seki664YYSLB6i+obhddomMDMhrQ=; b=aCZfsq9o156GR7R71+dCBzUKZDd4RU/2M8F8GIiW1dycdNPXlEddQy5YjbGye258Rdsm2X qdXglxbSX1kLc2tIkXiAiKBIaNJBNsSuIsmf1TKlrm/jBRRTqA7EPI46qtLmazWWz0MWag N76NZCJ19/+vtGEieP+BonuNksj6xOc= X-MC-Unique: isWFQoZGM2a54BMp3IhX_Q-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] storage_util: fix qemu-img sparse allocation Date: Tue, 25 Aug 2020 15:16:43 +0200 Message-Id: <3b168c465fff5bbd495ba8f5d2fadcd794a97ce7.1598361393.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit introduced a support to fully allocate qcow2 images when matches but it doesn't work as expected. The issue is that info.size_arg is in KB but the info.allocation introduced by the mentioned commit is in B. This results in using "preallocation=3Dfalloc," in cases where "preallocation=3Dmetadata," should be used. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/storage/storage_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index f7c09e3375..fcecedbc3a 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1044,7 +1044,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePo= olObjPtr pool, .type =3D NULL, .inputType =3D NULL, .path =3D vol->target.path, - .allocation =3D vol->target.allocation, + .allocation =3D VIR_DIV_UP(vol->target.allocation, 1024), .encryption =3D !!vol->target.encryption, .preallocate =3D !!(flags & VIR_STORAGE_VOL_CREATE_PREALLOC_METADA= TA), .compat =3D vol->target.compat, --=20 2.26.2