iotests: Test blockdev-reopen with iothreads and throttling
The 'throttle' block driver implements .bdrv_co_drain_end, so blockdev-reopen will have to wait for it to complete in the polling loop at the end of qmp_blockdev_reopen(). This makes AIO_WAIT_WHILE() release the AioContext lock, which causes a crash if the lock hasn't correctly been taken. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20220203140534.36522-3-kwolf@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
aba8205be0
commit
ee81060237
|
@ -1138,12 +1138,13 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
||||||
self.assertEqual(self.get_node('hd1'), None)
|
self.assertEqual(self.get_node('hd1'), None)
|
||||||
self.assert_qmp(self.get_node('hd2'), 'ro', True)
|
self.assert_qmp(self.get_node('hd2'), 'ro', True)
|
||||||
|
|
||||||
def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None):
|
def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None,
|
||||||
opts = hd_opts(0)
|
opts_a = None, opts_b = None):
|
||||||
|
opts = opts_a or hd_opts(0)
|
||||||
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
|
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
|
||||||
self.assert_qmp(result, 'return', {})
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
opts2 = hd_opts(2)
|
opts2 = opts_b or hd_opts(2)
|
||||||
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts2)
|
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts2)
|
||||||
self.assert_qmp(result, 'return', {})
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
|
@ -1194,6 +1195,35 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
||||||
def test_iothreads_switch_overlay(self):
|
def test_iothreads_switch_overlay(self):
|
||||||
self.run_test_iothreads('', 'iothread0')
|
self.run_test_iothreads('', 'iothread0')
|
||||||
|
|
||||||
|
def test_iothreads_with_throttling(self):
|
||||||
|
# Create a throttle-group object
|
||||||
|
opts = { 'qom-type': 'throttle-group', 'id': 'group0',
|
||||||
|
'limits': { 'iops-total': 1000 } }
|
||||||
|
result = self.vm.qmp('object-add', conv_keys = False, **opts)
|
||||||
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
|
# Options with a throttle filter between format and protocol
|
||||||
|
opts = [
|
||||||
|
{
|
||||||
|
'driver': iotests.imgfmt,
|
||||||
|
'node-name': f'hd{idx}',
|
||||||
|
'file' : {
|
||||||
|
'node-name': f'hd{idx}-throttle',
|
||||||
|
'driver': 'throttle',
|
||||||
|
'throttle-group': 'group0',
|
||||||
|
'file': {
|
||||||
|
'driver': 'file',
|
||||||
|
'node-name': f'hd{idx}-file',
|
||||||
|
'filename': hd_path[idx],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for idx in (0, 2)
|
||||||
|
]
|
||||||
|
|
||||||
|
self.run_test_iothreads('iothread0', 'iothread0', None,
|
||||||
|
opts[0], opts[1])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
iotests.activate_logging()
|
iotests.activate_logging()
|
||||||
iotests.main(supported_fmts=["qcow2"],
|
iotests.main(supported_fmts=["qcow2"],
|
||||||
|
|
|
@ -17,8 +17,8 @@ read 1/1 bytes at offset 262152
|
||||||
read 1/1 bytes at offset 262160
|
read 1/1 bytes at offset 262160
|
||||||
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
|
|
||||||
...............
|
................
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Ran 25 tests
|
Ran 26 tests
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
|
Loading…
Reference in New Issue