Blame SOURCES/kvm-iotests-Enhance-223-to-cover-multiple-bitmap-granula.patch

7711c0
From 4398dec3833e9a4c27c0394aaeee4329008d489a Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 20 Mar 2019 16:16:14 +0100
7711c0
Subject: [PATCH 016/163] iotests: Enhance 223 to cover multiple bitmap
7711c0
 granularities
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190320161631.14841-3-jsnow@redhat.com>
7711c0
Patchwork-id: 84939
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 02/19] iotests: Enhance 223 to cover multiple bitmap granularities
7711c0
Bugzilla: 1668956
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Eric Blake <eblake@redhat.com>
7711c0
7711c0
Testing granularity at the same size as the cluster isn't quite
7711c0
as fun as what happens when it is larger or smaller.  This
7711c0
enhancement also shows that qemu's nbd server can serve the
7711c0
same disk over multiple exports simultaneously.
7711c0
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
Tested-by: John Snow <jsnow@redhat.com>
7711c0
Reviewed-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
(cherry picked from commit a237dea330a2be9a2cbe95056b9a8d67627d95c6)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 tests/qemu-iotests/223     | 43 +++++++++++++++++++++++++++++++++++--------
7711c0
 tests/qemu-iotests/223.out | 32 +++++++++++++++++++++++++-------
7711c0
 2 files changed, 60 insertions(+), 15 deletions(-)
7711c0
7711c0
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
7711c0
index b63b7a4..a462f41 100755
7711c0
--- a/tests/qemu-iotests/223
7711c0
+++ b/tests/qemu-iotests/223
7711c0
@@ -56,10 +56,11 @@ function run_qemu()
7711c0
 }
7711c0
 
7711c0
 echo
7711c0
-echo "=== Create partially sparse image, then add dirty bitmap ==="
7711c0
+echo "=== Create partially sparse image, then add dirty bitmaps ==="
7711c0
 echo
7711c0
 
7711c0
-_make_test_img 4M
7711c0
+# Two bitmaps, to contrast granularity issues
7711c0
+_make_test_img -o cluster_size=4k 4M
7711c0
 $QEMU_IO -c 'w -P 0x11 1M 2M' "$TEST_IMG" | _filter_qemu_io
7711c0
 run_qemu <
7711c0
 { "execute": "qmp_capabilities" }
7711c0
@@ -77,7 +78,16 @@ run_qemu <
7711c0
   "arguments": {
7711c0
     "node": "n",
7711c0
     "name": "b",
7711c0
-    "persistent": true
7711c0
+    "persistent": true,
7711c0
+    "granularity": 65536
7711c0
+  }
7711c0
+}
7711c0
+{ "execute": "block-dirty-bitmap-add",
7711c0
+  "arguments": {
7711c0
+    "node": "n",
7711c0
+    "name": "b2",
7711c0
+    "persistent": true,
7711c0
+    "granularity": 512
7711c0
   }
7711c0
 }
7711c0
 { "execute": "quit" }
7711c0
@@ -87,10 +97,11 @@ echo
7711c0
 echo "=== Write part of the file under active bitmap ==="
7711c0
 echo
7711c0
 
7711c0
-$QEMU_IO -c 'w -P 0x22 2M 2M' "$TEST_IMG" | _filter_qemu_io
7711c0
+$QEMU_IO -c 'w -P 0x22 512 512' -c 'w -P 0x33 2M 2M' "$TEST_IMG" \
7711c0
+    | _filter_qemu_io
7711c0
 
7711c0
 echo
7711c0
-echo "=== End dirty bitmap, and start serving image over NBD ==="
7711c0
+echo "=== End dirty bitmaps, and start serving image over NBD ==="
7711c0
 echo
7711c0
 
7711c0
 _launch_qemu 2> >(_filter_nbd)
7711c0
@@ -102,6 +113,8 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
7711c0
     "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable",
7711c0
   "arguments":{"node":"n", "name":"b"}}' "return"
7711c0
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable",
7711c0
+  "arguments":{"node":"n", "name":"b2"}}' "return"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start",
7711c0
   "arguments":{"addr":{"type":"unix",
7711c0
     "data":{"path":"'"$TEST_DIR/nbd"'"}}}}' "return"
7711c0
@@ -109,26 +122,40 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
7711c0
   "arguments":{"device":"n"}}' "return"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap",
7711c0
   "arguments":{"name":"n", "bitmap":"b"}}' "return"
7711c0
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
7711c0
+  "arguments":{"device":"n", "name":"n2"}}' "return"
7711c0
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap",
7711c0
+  "arguments":{"name":"n2", "bitmap":"b2"}}' "return"
7711c0
 
7711c0
 echo
7711c0
-echo "=== Contrast normal status with dirty-bitmap status ==="
7711c0
+echo "=== Contrast normal status to large granularity dirty-bitmap ==="
7711c0
 echo
7711c0
 
7711c0
 QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
7711c0
 IMG="driver=nbd,export=n,server.type=unix,server.path=$TEST_DIR/nbd"
7711c0
-$QEMU_IO -r -c 'r -P 0 0 1m' -c 'r -P 0x11 1m 1m' \
7711c0
-  -c 'r -P 0x22 2m 2m' --image-opts "$IMG" | _filter_qemu_io
7711c0
+$QEMU_IO -r -c 'r -P 0x22 512 512' -c 'r -P 0 512k 512k' -c 'r -P 0x11 1m 1m' \
7711c0
+  -c 'r -P 0x33 2m 2m' --image-opts "$IMG" | _filter_qemu_io
7711c0
 $QEMU_IMG map --output=json --image-opts \
7711c0
   "$IMG" | _filter_qemu_img_map
7711c0
 $QEMU_IMG map --output=json --image-opts \
7711c0
   "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b" | _filter_qemu_img_map
7711c0
 
7711c0
 echo
7711c0
+echo "=== Contrast to small granularity dirty-bitmap ==="
7711c0
+echo
7711c0
+
7711c0
+IMG="driver=nbd,export=n2,server.type=unix,server.path=$TEST_DIR/nbd"
7711c0
+$QEMU_IMG map --output=json --image-opts \
7711c0
+  "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
7711c0
+
7711c0
+echo
7711c0
 echo "=== End NBD server ==="
7711c0
 echo
7711c0
 
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
7711c0
   "arguments":{"name":"n"}}' "return"
7711c0
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
7711c0
+  "arguments":{"name":"n2"}}' "return"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "return"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return"
7711c0
 
7711c0
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
7711c0
index 33021c8..de41747 100644
7711c0
--- a/tests/qemu-iotests/223.out
7711c0
+++ b/tests/qemu-iotests/223.out
7711c0
@@ -1,6 +1,6 @@
7711c0
 QA output created by 223
7711c0
 
7711c0
-=== Create partially sparse image, then add dirty bitmap ===
7711c0
+=== Create partially sparse image, then add dirty bitmaps ===
7711c0
 
7711c0
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304
7711c0
 wrote 2097152/2097152 bytes at offset 1048576
7711c0
@@ -11,15 +11,18 @@ QMP_VERSION
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
+{"return": {}}
7711c0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
7711c0
 
7711c0
 
7711c0
 === Write part of the file under active bitmap ===
7711c0
 
7711c0
+wrote 512/512 bytes at offset 512
7711c0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
 wrote 2097152/2097152 bytes at offset 2097152
7711c0
 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
 
7711c0
-=== End dirty bitmap, and start serving image over NBD ===
7711c0
+=== End dirty bitmaps, and start serving image over NBD ===
7711c0
 
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
@@ -27,18 +30,32 @@ wrote 2097152/2097152 bytes at offset 2097152
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
+{"return": {}}
7711c0
+{"return": {}}
7711c0
+{"return": {}}
7711c0
 
7711c0
-=== Contrast normal status with dirty-bitmap status ===
7711c0
+=== Contrast normal status to large granularity dirty-bitmap ===
7711c0
 
7711c0
-read 1048576/1048576 bytes at offset 0
7711c0
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
+read 512/512 bytes at offset 512
7711c0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
+read 524288/524288 bytes at offset 524288
7711c0
+512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
 read 1048576/1048576 bytes at offset 1048576
7711c0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
 read 2097152/2097152 bytes at offset 2097152
7711c0
 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
-[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false},
7711c0
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true},
7711c0
+{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false},
7711c0
 { "start": 1048576, "length": 3145728, "depth": 0, "zero": false, "data": true}]
7711c0
-[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true},
7711c0
+[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
7711c0
+{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
7711c0
+{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
7711c0
+
7711c0
+=== Contrast to small granularity dirty-bitmap ===
7711c0
+
7711c0
+[{ "start": 0, "length": 512, "depth": 0, "zero": false, "data": true},
7711c0
+{ "start": 512, "length": 512, "depth": 0, "zero": false, "data": false},
7711c0
+{ "start": 1024, "length": 2096128, "depth": 0, "zero": false, "data": true},
7711c0
 { "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
7711c0
 
7711c0
 === End NBD server ===
7711c0
@@ -46,4 +63,5 @@ read 2097152/2097152 bytes at offset 2097152
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
 {"return": {}}
7711c0
+{"return": {}}
7711c0
 *** done
7711c0
-- 
7711c0
1.8.3.1
7711c0