|
|
383d26 |
From f5f8208d1e759b789da9f2ae03b2320c355dbf89 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
Date: Mon, 18 Jun 2018 17:48:33 +0200
|
|
|
383d26 |
Subject: [PATCH 11/89] iotests: Add test for rebasing with relative paths
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
Message-id: <20180618174833.19439-3-mreitz@redhat.com>
|
|
|
383d26 |
Patchwork-id: 80789
|
|
|
383d26 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 2/2] iotests: Add test for rebasing with relative paths
|
|
|
383d26 |
Bugzilla: 1569835
|
|
|
383d26 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
Message-id: 20180509182002.8044-3-mreitz@redhat.com
|
|
|
383d26 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 28036a7f7044fddb79819e3c8fcb4ae5605c60e0)
|
|
|
383d26 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
tests/qemu-iotests/024 | 82 ++++++++++++++++++++++++++++++++++++++++++++--
|
|
|
383d26 |
tests/qemu-iotests/024.out | 30 +++++++++++++++++
|
|
|
383d26 |
2 files changed, 109 insertions(+), 3 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
|
|
|
383d26 |
index e0d77ce..4071ed6 100755
|
|
|
383d26 |
--- a/tests/qemu-iotests/024
|
|
|
383d26 |
+++ b/tests/qemu-iotests/024
|
|
|
383d26 |
@@ -29,9 +29,14 @@ status=1 # failure is the default!
|
|
|
383d26 |
|
|
|
383d26 |
_cleanup()
|
|
|
383d26 |
{
|
|
|
383d26 |
- _cleanup_test_img
|
|
|
383d26 |
- rm -f "$TEST_DIR/t.$IMGFMT.base_old"
|
|
|
383d26 |
- rm -f "$TEST_DIR/t.$IMGFMT.base_new"
|
|
|
383d26 |
+ _cleanup_test_img
|
|
|
383d26 |
+ rm -f "$TEST_DIR/t.$IMGFMT.base_old"
|
|
|
383d26 |
+ rm -f "$TEST_DIR/t.$IMGFMT.base_new"
|
|
|
383d26 |
+
|
|
|
383d26 |
+ rm -f "$TEST_DIR/subdir/t.$IMGFMT"
|
|
|
383d26 |
+ rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_old"
|
|
|
383d26 |
+ rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_new"
|
|
|
383d26 |
+ rmdir "$TEST_DIR/subdir" 2> /dev/null
|
|
|
383d26 |
}
|
|
|
383d26 |
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
383d26 |
|
|
|
383d26 |
@@ -123,6 +128,77 @@ io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
|
|
|
383d26 |
io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
|
|
|
383d26 |
io_pattern readv $((15 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
|
|
|
383d26 |
|
|
|
383d26 |
+echo
|
|
|
383d26 |
+echo "=== Test rebase in a subdirectory of the working directory ==="
|
|
|
383d26 |
+echo
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Clean up the old images beforehand so they do not interfere with
|
|
|
383d26 |
+# this test
|
|
|
383d26 |
+_cleanup
|
|
|
383d26 |
+
|
|
|
383d26 |
+mkdir "$TEST_DIR/subdir"
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Relative to the overlay
|
|
|
383d26 |
+BASE_OLD_OREL="t.$IMGFMT.base_old"
|
|
|
383d26 |
+BASE_NEW_OREL="t.$IMGFMT.base_new"
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Relative to $TEST_DIR (which is going to be our working directory)
|
|
|
383d26 |
+OVERLAY_WREL="subdir/t.$IMGFMT"
|
|
|
383d26 |
+
|
|
|
383d26 |
+BASE_OLD="$TEST_DIR/subdir/$BASE_OLD_OREL"
|
|
|
383d26 |
+BASE_NEW="$TEST_DIR/subdir/$BASE_NEW_OREL"
|
|
|
383d26 |
+OVERLAY="$TEST_DIR/$OVERLAY_WREL"
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Test done here:
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# Backing (old): 11 11 -- 11
|
|
|
383d26 |
+# Backing (new): -- 22 22 11
|
|
|
383d26 |
+# Overlay: -- -- -- --
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# Rebasing works, we have verified that above. Here, we just want to
|
|
|
383d26 |
+# see that rebasing is done for the correct target backing file.
|
|
|
383d26 |
+
|
|
|
383d26 |
+TEST_IMG=$BASE_OLD _make_test_img 1M
|
|
|
383d26 |
+TEST_IMG=$BASE_NEW _make_test_img 1M
|
|
|
383d26 |
+TEST_IMG=$OVERLAY _make_test_img -b "$BASE_OLD_OREL" 1M
|
|
|
383d26 |
+
|
|
|
383d26 |
+echo
|
|
|
383d26 |
+
|
|
|
383d26 |
+$QEMU_IO "$BASE_OLD" \
|
|
|
383d26 |
+ -c "write -P 0x11 $((0 * CLUSTER_SIZE)) $((2 * CLUSTER_SIZE))" \
|
|
|
383d26 |
+ -c "write -P 0x11 $((3 * CLUSTER_SIZE)) $((1 * CLUSTER_SIZE))" \
|
|
|
383d26 |
+ | _filter_qemu_io
|
|
|
383d26 |
+
|
|
|
383d26 |
+$QEMU_IO "$BASE_NEW" \
|
|
|
383d26 |
+ -c "write -P 0x22 $((1 * CLUSTER_SIZE)) $((2 * CLUSTER_SIZE))" \
|
|
|
383d26 |
+ -c "write -P 0x11 $((3 * CLUSTER_SIZE)) $((1 * CLUSTER_SIZE))" \
|
|
|
383d26 |
+ | _filter_qemu_io
|
|
|
383d26 |
+
|
|
|
383d26 |
+echo
|
|
|
383d26 |
+
|
|
|
383d26 |
+pushd "$TEST_DIR" >/dev/null
|
|
|
383d26 |
+$QEMU_IMG rebase -f "$IMGFMT" -b "$BASE_NEW_OREL" "$OVERLAY_WREL"
|
|
|
383d26 |
+popd >/dev/null
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Verify the backing path is correct
|
|
|
383d26 |
+TEST_IMG=$OVERLAY _img_info | grep '^backing file'
|
|
|
383d26 |
+
|
|
|
383d26 |
+echo
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Verify the data is correct
|
|
|
383d26 |
+$QEMU_IO "$OVERLAY" \
|
|
|
383d26 |
+ -c "read -P 0x11 $((0 * CLUSTER_SIZE)) $CLUSTER_SIZE" \
|
|
|
383d26 |
+ -c "read -P 0x11 $((1 * CLUSTER_SIZE)) $CLUSTER_SIZE" \
|
|
|
383d26 |
+ -c "read -P 0x00 $((2 * CLUSTER_SIZE)) $CLUSTER_SIZE" \
|
|
|
383d26 |
+ -c "read -P 0x11 $((3 * CLUSTER_SIZE)) $CLUSTER_SIZE" \
|
|
|
383d26 |
+ | _filter_qemu_io
|
|
|
383d26 |
+
|
|
|
383d26 |
+echo
|
|
|
383d26 |
+
|
|
|
383d26 |
+# Verify that cluster #3 is not allocated (because it is the same in
|
|
|
383d26 |
+# $BASE_OLD and $BASE_NEW)
|
|
|
383d26 |
+$QEMU_IMG map "$OVERLAY" | _filter_qemu_img_map
|
|
|
383d26 |
+
|
|
|
383d26 |
|
|
|
383d26 |
# success, all done
|
|
|
383d26 |
echo "*** done"
|
|
|
383d26 |
diff --git a/tests/qemu-iotests/024.out b/tests/qemu-iotests/024.out
|
|
|
383d26 |
index 33cfaf5..024dc78 100644
|
|
|
383d26 |
--- a/tests/qemu-iotests/024.out
|
|
|
383d26 |
+++ b/tests/qemu-iotests/024.out
|
|
|
383d26 |
@@ -141,4 +141,34 @@ read 65536/65536 bytes at offset 917504
|
|
|
383d26 |
=== IO: pattern 0x00
|
|
|
383d26 |
read 65536/65536 bytes at offset 983040
|
|
|
383d26 |
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+
|
|
|
383d26 |
+=== Test rebase in a subdirectory of the working directory ===
|
|
|
383d26 |
+
|
|
|
383d26 |
+Formatting 'TEST_DIR/subdir/t.IMGFMT.base_old', fmt=IMGFMT size=1048576
|
|
|
383d26 |
+Formatting 'TEST_DIR/subdir/t.IMGFMT.base_new', fmt=IMGFMT size=1048576
|
|
|
383d26 |
+Formatting 'TEST_DIR/subdir/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=t.IMGFMT.base_old
|
|
|
383d26 |
+
|
|
|
383d26 |
+wrote 131072/131072 bytes at offset 0
|
|
|
383d26 |
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+wrote 65536/65536 bytes at offset 196608
|
|
|
383d26 |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+wrote 131072/131072 bytes at offset 65536
|
|
|
383d26 |
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+wrote 65536/65536 bytes at offset 196608
|
|
|
383d26 |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+
|
|
|
383d26 |
+backing file: t.IMGFMT.base_new (actual path: TEST_DIR/subdir/t.IMGFMT.base_new)
|
|
|
383d26 |
+
|
|
|
383d26 |
+read 65536/65536 bytes at offset 0
|
|
|
383d26 |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+read 65536/65536 bytes at offset 65536
|
|
|
383d26 |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+read 65536/65536 bytes at offset 131072
|
|
|
383d26 |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+read 65536/65536 bytes at offset 196608
|
|
|
383d26 |
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
383d26 |
+
|
|
|
383d26 |
+Offset Length File
|
|
|
383d26 |
+0 0x30000 TEST_DIR/subdir/t.IMGFMT
|
|
|
383d26 |
+0x30000 0x10000 TEST_DIR/subdir/t.IMGFMT.base_new
|
|
|
383d26 |
*** done
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|