From nobody Sun Nov 24 10:45:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1724324111880359.2848955876234; Thu, 22 Aug 2024 03:55:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sh5SU-0003ex-69; Thu, 22 Aug 2024 06:54:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sh5SR-0003eS-Je for qemu-devel@nongnu.org; Thu, 22 Aug 2024 06:54:23 -0400 Received: from [1.203.97.240] (helo=smtp.cecloud.com) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sh5SO-0002mz-VK for qemu-devel@nongnu.org; Thu, 22 Aug 2024 06:54:23 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.cecloud.com (Postfix) with ESMTP id 04F74900113; Thu, 22 Aug 2024 18:54:09 +0800 (CST) Received: from localhost.localdomain (unknown [111.48.58.10]) by smtp.cecloud.com (postfix) whith ESMTP id P1340312T281473046933872S1724324047027053_; Thu, 22 Aug 2024 18:54:08 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 X-IP-DOMAINF: 1 X-RL-SENDER: luzhipeng@cestc.cn X-SENDER: luzhipeng@cestc.cn X-LOGIN-NAME: luzhipeng@cestc.cn X-FST-TO: qemu-devel@nongnu.org X-RCPT-COUNT: 6 X-LOCAL-RCPT-COUNT: 1 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 111.48.58.10 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: <87d4f5d528284d5139c9d68a5d078646> X-System-Flag: 0 From: luzhipeng To: qemu-devel Cc: Fam Zheng , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, luzhipeng Subject: [PATCH] vmdk:truncate more one sector in init extent Date: Thu, 22 Aug 2024 18:52:37 +0800 Message-Id: <20240822105237.777-1-luzhipeng@cestc.cn> X-Mailer: git-send-email 2.34.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 1.203.97.240 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=1.203.97.240; envelope-from=luzhipeng@cestc.cn; helo=smtp.cecloud.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1724324116470116600 Content-Type: text/plain; charset="utf-8" issue:https://gitlab.com/qemu-project/qemu/-/issues/1357 empty vmdk only contains metadata, ovftool failed. So it allocates more one sector for empty disk. the ovftool command line: ovftool input.ovf output.ova Signed-off-by: luzhipeng --- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/vmdk.c b/block/vmdk.c index 78f6433607..283dee9b49 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2286,7 +2286,7 @@ vmdk_init_extent(BlockBackend *blk, int64_t filesize,= bool flat, bool compress, goto exit; } =20 - ret =3D blk_co_truncate(blk, le64_to_cpu(header.grain_offset) << 9, fa= lse, + ret =3D blk_co_truncate(blk, (le64_to_cpu(header.grain_offset) << 9) += BDRV_SECTOR_SIZE, + false, PREALLOC_MODE_OFF, 0, errp); if (ret < 0) { goto exit; --=20 2.39.3