qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/3] iotests.py: Add supports_qcow2_zstd_compression()


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v3 1/3] iotests.py: Add supports_qcow2_zstd_compression()
Date: Wed, 23 Mar 2022 14:47:42 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

23.03.2022 13:55, Hanna Reitz wrote:
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
  tests/qemu-iotests/iotests.py | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index fcec3e51e5..fe10a6cf05 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -1471,6 +1471,26 @@ def verify_working_luks():
      if not working:
          notrun(reason)
+def supports_qcow2_zstd_compression() -> bool:
+    img_file = f'{test_dir}/qcow2-zstd-test.qcow2'
+    res = qemu_img('create', '-f', 'qcow2', '-o', 'compression_type=zstd',
+                   img_file, '0',
+                   check=False)

check=False may be squashed into previous line

+    try:
+        os.remove(img_file)
+    except OSError:
+        pass
+
+    if res.returncode == 1 and \
+            "'compression-type' does not accept value 'zstd'" in res.stdout:
+        return False
+    else:
+        return True

May be:

return not(res.returncode == 1 and
   "'compression-type' does not accept value 'zstd'" in res.stdout)

+
+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).

anyway:
Reviewed-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>

--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]