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 <luzhip...@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




Reply via email to