|
|
1bdc94 |
From 4368733f4cfd8aa424c6f14f950b8e33db6829f2 Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Date: Mon, 18 Jun 2018 18:04:51 +0200
|
|
|
1bdc94 |
Subject: [PATCH 13/89] iotests: Test post-backing convert target behavior
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180618180451.23808-3-mreitz@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 80797
|
|
|
1bdc94 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 2/2] iotests: Test post-backing convert target behavior
|
|
|
1bdc94 |
Bugzilla: 1527898
|
|
|
1bdc94 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
This adds a test case to 122 for what happens when you convert to a
|
|
|
1bdc94 |
target with a backing file that is shorter than the target, and the
|
|
|
1bdc94 |
image format does not support efficient zero writes (as is the case with
|
|
|
1bdc94 |
qcow2 v2).
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Message-id: 20180501165750.19242-3-mreitz@redhat.com
|
|
|
1bdc94 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit 0682854f899d03c78befce9f5aae4a7e37655d25)
|
|
|
1bdc94 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
tests/qemu-iotests/122 | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
1bdc94 |
tests/qemu-iotests/122.out | 18 ++++++++++++++++++
|
|
|
1bdc94 |
2 files changed, 60 insertions(+)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
|
|
|
1bdc94 |
index 45b359c..d8c8ad7 100755
|
|
|
1bdc94 |
--- a/tests/qemu-iotests/122
|
|
|
1bdc94 |
+++ b/tests/qemu-iotests/122
|
|
|
1bdc94 |
@@ -77,6 +77,48 @@ $QEMU_IO -c "read -P 0 0 3M" "$TEST_IMG".orig 2>&1 | _filter_qemu_io | _filter_t
|
|
|
1bdc94 |
|
|
|
1bdc94 |
|
|
|
1bdc94 |
echo
|
|
|
1bdc94 |
+echo "=== Converting to an overlay larger than its backing file ==="
|
|
|
1bdc94 |
+echo
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+TEST_IMG="$TEST_IMG".base _make_test_img 256M
|
|
|
1bdc94 |
+# Needs to be at least how much an L2 table covers
|
|
|
1bdc94 |
+# (64 kB/entry * 64 kB / 8 B/entry = 512 MB)
|
|
|
1bdc94 |
+# That way, qcow2 will yield at least two status request responses.
|
|
|
1bdc94 |
+# With just a single response, it would always say "Allocated in the
|
|
|
1bdc94 |
+# backing file", so the optimization qemu-img convert tries to do is
|
|
|
1bdc94 |
+# done automatically. Once it has to be queried twice, however (and
|
|
|
1bdc94 |
+# one of the queries is completely after the end of the backing file),
|
|
|
1bdc94 |
+# the block layer will automatically add a ZERO flag that qemu-img
|
|
|
1bdc94 |
+# convert used to follow up with a zero write to the target.
|
|
|
1bdc94 |
+# We do not want such a zero write, however, because we are past the
|
|
|
1bdc94 |
+# end of the backing file on the target as well, so we do not need to
|
|
|
1bdc94 |
+# write anything there.
|
|
|
1bdc94 |
+_make_test_img -b "$TEST_IMG".base 768M
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+# Use compat=0.10 as the output so there is no zero cluster support
|
|
|
1bdc94 |
+$QEMU_IMG convert -O $IMGFMT -B "$TEST_IMG".base -o compat=0.10 \
|
|
|
1bdc94 |
+ "$TEST_IMG" "$TEST_IMG".orig
|
|
|
1bdc94 |
+# See that nothing has been allocated past 64M
|
|
|
1bdc94 |
+$QEMU_IMG map "$TEST_IMG".orig | _filter_qemu_img_map
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+echo
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+# Just before the end of the backing file
|
|
|
1bdc94 |
+$QEMU_IO -c 'write -P 0x11 255M 1M' "$TEST_IMG".base 2>&1 | _filter_qemu_io
|
|
|
1bdc94 |
+# Somewhere in the second L2 table
|
|
|
1bdc94 |
+$QEMU_IO -c 'write -P 0x22 600M 1M' "$TEST_IMG" 2>&1 | _filter_qemu_io
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+$QEMU_IMG convert -O $IMGFMT -B "$TEST_IMG".base -o compat=0.10 \
|
|
|
1bdc94 |
+ "$TEST_IMG" "$TEST_IMG".orig
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+$QEMU_IMG map "$TEST_IMG".orig | _filter_qemu_img_map
|
|
|
1bdc94 |
+$QEMU_IO -c 'read -P 0x11 255M 1M' \
|
|
|
1bdc94 |
+ -c 'read -P 0x22 600M 1M' \
|
|
|
1bdc94 |
+ "$TEST_IMG".orig \
|
|
|
1bdc94 |
+ | _filter_qemu_io
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+echo
|
|
|
1bdc94 |
echo "=== Concatenate multiple source images ==="
|
|
|
1bdc94 |
echo
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out
|
|
|
1bdc94 |
index 47d8656..6c7ee1d 100644
|
|
|
1bdc94 |
--- a/tests/qemu-iotests/122.out
|
|
|
1bdc94 |
+++ b/tests/qemu-iotests/122.out
|
|
|
1bdc94 |
@@ -28,6 +28,24 @@ read 3145728/3145728 bytes at offset 0
|
|
|
1bdc94 |
read 3145728/3145728 bytes at offset 0
|
|
|
1bdc94 |
3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
+=== Converting to an overlay larger than its backing file ===
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=268435456
|
|
|
1bdc94 |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=805306368 backing_file=TEST_DIR/t.IMGFMT.base
|
|
|
1bdc94 |
+Offset Length File
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+wrote 1048576/1048576 bytes at offset 267386880
|
|
|
1bdc94 |
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
1bdc94 |
+wrote 1048576/1048576 bytes at offset 629145600
|
|
|
1bdc94 |
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
1bdc94 |
+Offset Length File
|
|
|
1bdc94 |
+0xff00000 0x100000 TEST_DIR/t.IMGFMT.base
|
|
|
1bdc94 |
+0x25800000 0x100000 TEST_DIR/t.IMGFMT.orig
|
|
|
1bdc94 |
+read 1048576/1048576 bytes at offset 267386880
|
|
|
1bdc94 |
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
1bdc94 |
+read 1048576/1048576 bytes at offset 629145600
|
|
|
1bdc94 |
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
=== Concatenate multiple source images ===
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Formatting 'TEST_DIR/t.IMGFMT.1', fmt=IMGFMT size=4194304
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|