[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/17] iotests: Convert to preallocated encrypted qco
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 10/17] iotests: Convert to preallocated encrypted qcow2 |
Date: |
Mon, 19 Aug 2019 18:17:16 +0200 |
Add a test case for converting an empty image (which only returns zeroes
when read) to a preallocated encrypted qcow2 image.
qcow2_has_zero_init() should return 0 then, thus forcing qemu-img
convert to create zero clusters.
Signed-off-by: Max Reitz <address@hidden>
Acked-by: Stefano Garzarella <address@hidden>
Tested-by: Stefano Garzarella <address@hidden>
Message-id: address@hidden
Reviewed-by: Maxim Levitsky <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/188 | 20 +++++++++++++++++++-
tests/qemu-iotests/188.out | 4 ++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/188 b/tests/qemu-iotests/188
index be7278aa65..afca44df54 100755
--- a/tests/qemu-iotests/188
+++ b/tests/qemu-iotests/188
@@ -48,7 +48,7 @@ SECRETALT="secret,id=sec0,data=platypus"
_make_test_img --object $SECRET -o
"encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10" $size
-IMGSPEC="driver=$IMGFMT,file.filename=$TEST_IMG,encrypt.key-secret=sec0"
+IMGSPEC="driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG"
QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
@@ -68,6 +68,24 @@ echo
echo "== verify open failure with wrong password =="
$QEMU_IO --object $SECRETALT -c "read -P 0xa 0 $size" --image-opts $IMGSPEC |
_filter_qemu_io | _filter_testdir
+_cleanup_test_img
+
+echo
+echo "== verify that has_zero_init returns false when preallocating =="
+
+# Empty source file
+if [ -n "$TEST_IMG_FILE" ]; then
+ TEST_IMG_FILE="${TEST_IMG_FILE}.orig" _make_test_img $size
+else
+ TEST_IMG="${TEST_IMG}.orig" _make_test_img $size
+fi
+
+$QEMU_IMG convert -O "$IMGFMT" --object $SECRET \
+ -o
"encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10,preallocation=metadata"
\
+ "${TEST_IMG}.orig" "$TEST_IMG"
+
+$QEMU_IMG compare --object $SECRET --image-opts "${IMGSPEC}.orig" "$IMGSPEC"
+
# success, all done
echo "*** done"
diff --git a/tests/qemu-iotests/188.out b/tests/qemu-iotests/188.out
index 97b1402671..c568ef3701 100644
--- a/tests/qemu-iotests/188.out
+++ b/tests/qemu-iotests/188.out
@@ -15,4 +15,8 @@ read 16777216/16777216 bytes at offset 0
== verify open failure with wrong password ==
qemu-io: can't open: Invalid password, cannot unlock any keyslot
+
+== verify that has_zero_init returns false when preallocating ==
+Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=16777216
+Images are identical.
*** done
--
2.21.0
- [Qemu-devel] [PULL 00/17] Block patches, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 02/17] qemu-img: Fix bdrv_has_zero_init() use in convert, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 01/17] LUKS: support preallocation, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 03/17] mirror: Fix bdrv_has_zero_init() use, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 04/17] block: Add bdrv_has_zero_init_truncate(), Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 05/17] block: Implement .bdrv_has_zero_init_truncate(), Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 06/17] block: Use bdrv_has_zero_init_truncate(), Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 07/17] qcow2: Fix .bdrv_has_zero_init(), Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 08/17] vdi: Fix .bdrv_has_zero_init(), Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 09/17] vhdx: Fix .bdrv_has_zero_init(), Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 10/17] iotests: Convert to preallocated encrypted qcow2,
Max Reitz <=
- [Qemu-devel] [PULL 11/17] iotests: Test convert -n to pre-filled image, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 14/17] vmdk: Make block_status recurse for flat extents, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 15/17] vpc: Do not return RAW from block_status, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 13/17] vdi: Make block_status recurse for fixed images, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 17/17] doc: Preallocation does not require writing zeroes, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 12/17] iotests: Full mirror to existing non-zero image, Max Reitz, 2019/08/19
- [Qemu-devel] [PULL 16/17] iotests: Fix 141 when run with qed, Max Reitz, 2019/08/19
- Re: [Qemu-devel] [PULL 00/17] Block patches, Peter Maydell, 2019/08/20