[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 10/29] qemu-iotests: Fix locking issue in 102
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 10/29] qemu-iotests: Fix locking issue in 102 |
Date: |
Tue, 23 Jan 2018 15:01:42 +0100 |
From: Max Reitz <address@hidden>
102 truncates a qcow2 file (the raw file) on purpose while a VM is
running. However, image locking will usually prevent exactly this.
The fact that most people have not noticed until now (I suppose you may
have seen sporadic failures, but not taken them too seriously, like me)
further shows that this truncation is actually not really done
concurrently, but that the VM is still starting up by this point and has
not yet opened the image. Remedy this by waiting for the monitor shell
to appear before the qemu-img invocation so we know the VM is up.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/102 | 7 ++++++-
tests/qemu-iotests/102.out | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
index d7ad8d9840..04b3f28445 100755
--- a/tests/qemu-iotests/102
+++ b/tests/qemu-iotests/102
@@ -69,7 +69,12 @@ $QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
qemu_comm_method=monitor _launch_qemu -drive if=none,file="$TEST_IMG",id=drv0
-$QEMU_IMG resize -f raw --shrink "$TEST_IMG" $((5 * 64 * 1024))
+# Wait for a prompt to appear (so we know qemu has opened the image)
+_send_qemu_cmd '' '(qemu)'
+
+$QEMU_IMG resize --shrink --image-opts \
+ "driver=raw,file.driver=file,file.filename=$TEST_IMG,file.locking=off" \
+ $((5 * 64 * 1024))
_send_qemu_cmd $QEMU_HANDLE 'qemu-io drv0 map' 'allocated' \
| sed -e 's/^(qemu).*qemu-io drv0 map...$/(qemu) qemu-io drv0 map/'
diff --git a/tests/qemu-iotests/102.out b/tests/qemu-iotests/102.out
index ccf172abd9..4401b08fee 100644
--- a/tests/qemu-iotests/102.out
+++ b/tests/qemu-iotests/102.out
@@ -14,8 +14,9 @@ Offset Length Mapped to File
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
wrote 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-Image resized.
QEMU X.Y.Z monitor - type 'help' for more information
+Image resized.
+(qemu)
(qemu) qemu-io drv0 map
64 KiB (0x10000) bytes allocated at offset 0 bytes (0x0)
*** done
--
2.13.6
- [Qemu-block] [PULL 00/29] Block layer patches, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 02/29] hw/block: Fix pin-based interrupt behaviour of NVMe, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 05/29] qcow2: Repair unaligned preallocated zero clusters, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 01/29] osdep: Retry SETLK upon EINTR, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 03/29] tests/.gitignore: Add test-bdrv-drain, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 08/29] blockdev: Drop BD-{remove, insert}-medium's @device, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 04/29] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 07/29] tests/ahci: Switch tray and medium commands to @id, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 06/29] iotests: Make BD-{remove, insert}-medium use @id, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 12/29] qcow2: No persistent dirty bitmaps for compat=0.10, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 10/29] qemu-iotests: Fix locking issue in 102,
Kevin Wolf <=
- [Qemu-block] [PULL 15/29] iotests: Fix _img_info for backslashes, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 13/29] block/qcow: Add blkdebug events, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 09/29] blockdev: Mark BD-{remove, insert}-medium stable, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 11/29] block/vmdk: Fix , instead of ; at end of line, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 16/29] iotests: Drop format-specific in _filter_img_info, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 14/29] block/vmdk: Add blkdebug events, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 21/29] iotests: Fix 059's reference output, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 18/29] iotests: Skip 103 for refcount_bits=1, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 17/29] iotests: Forbid 020 for non-file protocols, Kevin Wolf, 2018/01/23
- [Qemu-block] [PULL 24/29] iotests: Make 184 image-less, Kevin Wolf, 2018/01/23