|
|
4841a6 |
From ea4d8424fb2053b1cbb9538190b2b06351054125 Mon Sep 17 00:00:00 2001
|
|
|
4841a6 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
4841a6 |
Date: Thu, 3 Feb 2022 15:05:34 +0100
|
|
|
4841a6 |
Subject: [PATCH 3/5] iotests: Test blockdev-reopen with iothreads and
|
|
|
4841a6 |
throttling
|
|
|
4841a6 |
|
|
|
4841a6 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
4841a6 |
RH-MergeRequest: 142: block: Lock AioContext for drain_end in blockdev-reopen
|
|
|
4841a6 |
RH-Commit: [2/2] 91d365864c391ca7db7db13260913fb61987b833
|
|
|
4841a6 |
RH-Bugzilla: 2067118
|
|
|
4841a6 |
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
|
4841a6 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
4841a6 |
RH-Acked-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
4841a6 |
|
|
|
4841a6 |
The 'throttle' block driver implements .bdrv_co_drain_end, so
|
|
|
4841a6 |
blockdev-reopen will have to wait for it to complete in the polling
|
|
|
4841a6 |
loop at the end of qmp_blockdev_reopen(). This makes AIO_WAIT_WHILE()
|
|
|
4841a6 |
release the AioContext lock, which causes a crash if the lock hasn't
|
|
|
4841a6 |
correctly been taken.
|
|
|
4841a6 |
|
|
|
4841a6 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4841a6 |
Message-Id: <20220203140534.36522-3-kwolf@redhat.com>
|
|
|
4841a6 |
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
4841a6 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4841a6 |
(cherry picked from commit ee810602376125ca0e0afd6b7c715e13740978ea)
|
|
|
4841a6 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4841a6 |
---
|
|
|
4841a6 |
tests/qemu-iotests/245 | 36 +++++++++++++++++++++++++++++++++---
|
|
|
4841a6 |
tests/qemu-iotests/245.out | 4 ++--
|
|
|
4841a6 |
2 files changed, 35 insertions(+), 5 deletions(-)
|
|
|
4841a6 |
|
|
|
4841a6 |
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
|
|
|
4841a6 |
index 24ac43f70e..8cbed7821b 100755
|
|
|
4841a6 |
--- a/tests/qemu-iotests/245
|
|
|
4841a6 |
+++ b/tests/qemu-iotests/245
|
|
|
4841a6 |
@@ -1138,12 +1138,13 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
|
|
4841a6 |
self.assertEqual(self.get_node('hd1'), None)
|
|
|
4841a6 |
self.assert_qmp(self.get_node('hd2'), 'ro', True)
|
|
|
4841a6 |
|
|
|
4841a6 |
- def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None):
|
|
|
4841a6 |
- opts = hd_opts(0)
|
|
|
4841a6 |
+ def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None,
|
|
|
4841a6 |
+ opts_a = None, opts_b = None):
|
|
|
4841a6 |
+ opts = opts_a or hd_opts(0)
|
|
|
4841a6 |
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
|
|
|
4841a6 |
self.assert_qmp(result, 'return', {})
|
|
|
4841a6 |
|
|
|
4841a6 |
- opts2 = hd_opts(2)
|
|
|
4841a6 |
+ opts2 = opts_b or hd_opts(2)
|
|
|
4841a6 |
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts2)
|
|
|
4841a6 |
self.assert_qmp(result, 'return', {})
|
|
|
4841a6 |
|
|
|
4841a6 |
@@ -1194,6 +1195,35 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
|
|
4841a6 |
def test_iothreads_switch_overlay(self):
|
|
|
4841a6 |
self.run_test_iothreads('', 'iothread0')
|
|
|
4841a6 |
|
|
|
4841a6 |
+ def test_iothreads_with_throttling(self):
|
|
|
4841a6 |
+ # Create a throttle-group object
|
|
|
4841a6 |
+ opts = { 'qom-type': 'throttle-group', 'id': 'group0',
|
|
|
4841a6 |
+ 'limits': { 'iops-total': 1000 } }
|
|
|
4841a6 |
+ result = self.vm.qmp('object-add', conv_keys = False, **opts)
|
|
|
4841a6 |
+ self.assert_qmp(result, 'return', {})
|
|
|
4841a6 |
+
|
|
|
4841a6 |
+ # Options with a throttle filter between format and protocol
|
|
|
4841a6 |
+ opts = [
|
|
|
4841a6 |
+ {
|
|
|
4841a6 |
+ 'driver': iotests.imgfmt,
|
|
|
4841a6 |
+ 'node-name': f'hd{idx}',
|
|
|
4841a6 |
+ 'file' : {
|
|
|
4841a6 |
+ 'node-name': f'hd{idx}-throttle',
|
|
|
4841a6 |
+ 'driver': 'throttle',
|
|
|
4841a6 |
+ 'throttle-group': 'group0',
|
|
|
4841a6 |
+ 'file': {
|
|
|
4841a6 |
+ 'driver': 'file',
|
|
|
4841a6 |
+ 'node-name': f'hd{idx}-file',
|
|
|
4841a6 |
+ 'filename': hd_path[idx],
|
|
|
4841a6 |
+ },
|
|
|
4841a6 |
+ },
|
|
|
4841a6 |
+ }
|
|
|
4841a6 |
+ for idx in (0, 2)
|
|
|
4841a6 |
+ ]
|
|
|
4841a6 |
+
|
|
|
4841a6 |
+ self.run_test_iothreads('iothread0', 'iothread0', None,
|
|
|
4841a6 |
+ opts[0], opts[1])
|
|
|
4841a6 |
+
|
|
|
4841a6 |
if __name__ == '__main__':
|
|
|
4841a6 |
iotests.activate_logging()
|
|
|
4841a6 |
iotests.main(supported_fmts=["qcow2"],
|
|
|
4841a6 |
diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out
|
|
|
4841a6 |
index 4eced19294..a4e04a3266 100644
|
|
|
4841a6 |
--- a/tests/qemu-iotests/245.out
|
|
|
4841a6 |
+++ b/tests/qemu-iotests/245.out
|
|
|
4841a6 |
@@ -17,8 +17,8 @@ read 1/1 bytes at offset 262152
|
|
|
4841a6 |
read 1/1 bytes at offset 262160
|
|
|
4841a6 |
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
4841a6 |
|
|
|
4841a6 |
-...............
|
|
|
4841a6 |
+................
|
|
|
4841a6 |
----------------------------------------------------------------------
|
|
|
4841a6 |
-Ran 25 tests
|
|
|
4841a6 |
+Ran 26 tests
|
|
|
4841a6 |
|
|
|
4841a6 |
OK
|
|
|
4841a6 |
--
|
|
|
4841a6 |
2.27.0
|
|
|
4841a6 |
|