From cbaddb25b20060fa0b0a2a46d5ccca65cffd1a6f Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 15 Aug 2017 14:05:02 +0100 Subject: qemu-iotests: step clock after each test iteration The 093 throttling test submits twice as many requests as the throttle limit in order to ensure that we reach the limit. The remaining requests are left in-flight at the end of each test iteration. Commit 452589b6b47e8dc6353df257fc803dfc1383bed8 ("vl.c/exit: pause cpus before closing block devices") exposed a hang in 093. This happens because requests are still in flight when QEMU terminates but QEMU_CLOCK_VIRTUAL time is frozen. bdrv_drain_all() hangs forever since throttled requests cannot complete. Step the clock at the end of each test iteration so in-flight requests actually finish. This solves the hang and is cleaner than leaving tests in-flight. Note that this could also be "fixed" by disabling throttling when drives are closed in QEMU. That approach has two issues: 1. We must drain requests before disabling throttling, so the hang cannot be easily avoided! 2. Any time QEMU disables throttling internally there is a chance that malicious users can abuse the code path to bypass throttling limits. Therefore it makes more sense to fix the test case than to modify QEMU. Signed-off-by: Stefan Hajnoczi Message-Id: <20170815130502.8736-1-stefanha@redhat.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/093 | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 2ed393a..ef39972 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -133,6 +133,10 @@ class ThrottleTestCase(iotests.QMPTestCase): self.assertTrue(check_limit(params['iops_rd'], rd_iops)) self.assertTrue(check_limit(params['iops_wr'], wr_iops)) + # Allow remaining requests to finish. We submitted twice as many to + # ensure the throttle limit is reached. + self.vm.qtest("clock_step %d" % ns) + # Connect N drives to a VM and test I/O in all of them def test_all(self): params = {"bps": 4096, -- cgit v1.1 From dd7fdaad654d7484b66410b4b002b14644396587 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 15 Aug 2017 21:07:40 +0800 Subject: iotests: Add non-shared storage migration case 192 Signed-off-by: Fam Zheng Message-Id: <20170815130740.31229-5-famz@redhat.com> Tested-by: Eric Blake Signed-off-by: Eric Blake --- tests/qemu-iotests/192 | 63 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/192.out | 7 ++++++ tests/qemu-iotests/group | 1 + 3 files changed, 71 insertions(+) create mode 100755 tests/qemu-iotests/192 create mode 100644 tests/qemu-iotests/192.out (limited to 'tests') diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 new file mode 100755 index 0000000..b50a2c0 --- /dev/null +++ b/tests/qemu-iotests/192 @@ -0,0 +1,63 @@ +#!/bin/bash +# +# Test NBD export with -incoming (non-shared storage migration use case from +# libvirt) +# +# Copyright (C) 2017 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=famz@redhat.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt generic +_supported_proto file +_supported_os Linux + +if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then + _notrun "Requires a PC machine" +fi + +size=64M +_make_test_img $size + +{ +echo "nbd_server_start unix:$TEST_DIR/nbd" +echo "nbd_server_add -w drive0" +echo "q" +} | $QEMU -nodefaults -display none -monitor stdio \ + -drive format=$IMGFMT,file=$TEST_IMG,if=ide,id=drive0 \ + -incoming defer 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/192.out b/tests/qemu-iotests/192.out new file mode 100644 index 0000000..1e0be4c --- /dev/null +++ b/tests/qemu-iotests/192.out @@ -0,0 +1,7 @@ +QA output created by 192 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) nbd_server_start unix:TEST_DIR/nbd +(qemu) nbd_server_add -w drive0 +(qemu) q +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 1848077..afbdc42 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -186,3 +186,4 @@ 188 rw auto quick 189 rw auto 190 rw auto quick +192 rw auto quick -- cgit v1.1