On 8/5/22 18:47, alexander.iva...@virtuozzo.com wrote:
From: Alexander Ivanov <alexander.iva...@virtuozzo.com>
Check if original and duplicated offsets refer to the same cluster.
Repair the image and check that writing to a referred cluster
doesn't affects another referred cluster.
Signed-off-by: Natalia Kuzmina <natalia.kuzm...@openvz.org>
Signed-off-by: Alexander Ivanov <alexander.iva...@virtuozzo.com>
---
tests/qemu-iotests/314 | 89 ++++++++++++++++++
New tests should be added to tests/qemu-iotests/tests with good file names.
tests/qemu-iotests/314.out | 36 +++++++
.../parallels-2-duplicated-cluster.bz2 | Bin 0 -> 148 bytes
3 files changed, 125 insertions(+)
create mode 100755 tests/qemu-iotests/314
create mode 100644 tests/qemu-iotests/314.out
create mode 100644
tests/qemu-iotests/sample_images/parallels-2-duplicated-cluster.bz2
diff --git a/tests/qemu-iotests/314 b/tests/qemu-iotests/314
new file mode 100755
index 0000000000..79b4d3a749
--- /dev/null
+++ b/tests/qemu-iotests/314
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+# group: rw auto quick
+#
[..]
+
+#read one cluster from original offset
+$QEMU_IO -c "read -P 0x55 0 $CLUSTER_SIZE" "$TEST_IMG" | \
+ _filter_qemu_io
+#read copied data from new offset
+$QEMU_IO -c "read -P 0x55 $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE" "$TEST_IMG" | \
+ _filter_qemu_io
+#change data from original offset
+$QEMU_IO -c "write -P 0x11 0 $CLUSTER_SIZE" "$TEST_IMG" | \
+ _filter_qemu_io
+#read from new offset (fail, now this data was left unchanged)
+$QEMU_IO -c "read -P 0x11 $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE" "$TEST_IMG" | \
+ _filter_qemu_io
Maybe, add also read -P 0x55 for 4th cluster, to be sure that it's really
unchanged.
And maybe read 0x11 for 0th cluster, to be sure that it's really rewritten.
+
+echo
+echo
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
[..]
zcmZ>Y%CIzaj8qGboOfsS0tPO%`U`(O5*Pv)I2hO&I2yDPt~od`068263_Exd7-leV
zwiz(^Ft8k0sa3TsBZG0}Vv}35zt?O%VET5A+3Q2o4%bdpm~pLC^&`WR2CW6$VGH;&
vm{u|@;OhXBE0|U>d|v){U)AOQJ)h70iu-<&;S?CYW~db}a<vGU0CEKYoE$uo
literal 0
HcmV?d00001
With at least new test renamed and moved to tests/qemu-iotests/tests:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru>
--
Best regards,
Vladimir