qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vmdk:truncate more one sector in init extent
@ 2024-08-22 10:52 luzhipeng
  2024-10-18 16:31 ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: luzhipeng @ 2024-08-22 10:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Kevin Wolf, Hanna Reitz, qemu-block, luzhipeng

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 <luzhipeng@cestc.cn>
---
 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;
     }
 
-    ret = blk_co_truncate(blk, le64_to_cpu(header.grain_offset) << 9, false,
+    ret = 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;
-- 
2.39.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-20 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 10:52 [PATCH] vmdk:truncate more one sector in init extent luzhipeng
2024-10-18 16:31 ` Kevin Wolf
2024-10-20 14:07   ` Zhipeng Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).