[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/3] iotests.py: Add supports_qcow2_zstd_compression()
From: |
Hanna Reitz |
Subject: |
[PATCH v2 1/3] iotests.py: Add supports_qcow2_zstd_compression() |
Date: |
Wed, 2 Mar 2022 13:45:38 +0100 |
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
tests/qemu-iotests/iotests.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 6027780180..ce60abcadc 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -1377,6 +1377,27 @@ def verify_working_luks():
if not working:
notrun(reason)
+def supports_qcow2_zstd_compression() -> bool:
+ img_file = f'{test_dir}/qcow2-zstd-test.qcow2'
+ (output, status) = \
+ qemu_img_pipe_and_status('create', '-f', 'qcow2',
+ '-o', 'compression_type=zstd',
+ img_file, '0')
+ try:
+ os.remove(img_file)
+ except OSError:
+ pass
+
+ if status == 1 and \
+ "'compression-type' does not accept value 'zstd'" in output:
+ return False
+ else:
+ return True
+
+def verify_qcow2_zstd_compression():
+ if not supports_qcow2_zstd_compression():
+ notrun('zstd compression not supported')
+
def qemu_pipe(*args: str) -> str:
"""
Run qemu with an option to print something and exit (e.g. a help option).
--
2.34.1
- [PATCH v2 0/3] iotests: Check for zstd support, Hanna Reitz, 2022/03/02
- [PATCH v2 2/3] iotests/065: Check for zstd support, Hanna Reitz, 2022/03/02
- [PATCH v2 1/3] iotests.py: Add supports_qcow2_zstd_compression(),
Hanna Reitz <=
- [PATCH v2 3/3] iotests/303: Check for zstd support, Hanna Reitz, 2022/03/02
- Re: [PATCH v2 0/3] iotests: Check for zstd support, Hanna Reitz, 2022/03/22
- Re: [PATCH v2 0/3] iotests: Check for zstd support, Thomas Huth, 2022/03/22
- Re: [PATCH v2 0/3] iotests: Check for zstd support, Hanna Reitz, 2022/03/23