diff mbox series

[master-next,1/2] runqemu: use "zstd -o" to preserve sparse images

Message ID 20250806155549.3395012-1-yoann.congal@smile.fr
State New
Headers show
Series [master-next,1/2] runqemu: use "zstd -o" to preserve sparse images | expand

Commit Message

Yoann Congal Aug. 6, 2025, 3:55 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

wic images can be sparse. Using "zstd -o" preserves the sparse state of
the image and should decrease decompression time.

Suggested-by: Adrian Freihofer <adrian.freihofer@gmail.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 scripts/runqemu | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index 827300080a..4fb85177e3 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -448,8 +448,7 @@  class BaseConfig(object):
             if not shutil.which('zstd'):
                 raise RunQemuError(f"'zstd' is required to decompress {self.rootfs} but was not found in PATH")
             try:
-                with open(uncompressed_path, 'wb') as out_file:
-                    subprocess.check_call(['zstd', '-d', '-c', image_path], stdout=out_file)
+                subprocess.check_call(['zstd', '-d', image_path, '-o', uncompressed_path])
             except subprocess.CalledProcessError as e:
                 self.cleanup_files.append(uncompressed_path)
                 raise RunQemuError(f"Failed to decompress {self.rootfs}: {e}")