On 11.03.26 15:54, Fiona Ebner wrote:
Mostly in preparation for commit "iotests/041: add test for duplicate
job-complete with throttled target".
Signed-off-by: Fiona Ebner <[email protected]>
---
tests/qemu-iotests/041 | 112 ++++++++++++++++++++++++++++++++++++-
tests/qemu-iotests/041.out | 4 +-
2 files changed, 113 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 8452845f44..a7e1980f13 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
[...]
+ def tearDown(self):
+ os.remove(test_img)
+ os.remove(target_img)
+ os.remove(backing_img)
+ os.remove(target_backing_img)
It would be good if tearDown() could still contain the VM/QSD shutdown/stop.
+
+ def test_throttled(self):
+ self.vm.cmd('blockdev-mirror',
+ job_id='mirror',
+ device='source',
+ target='target',
+ sync='full')
+
+ time.sleep(1)
+ result = self.vm.qmp('query-block-jobs')
+ self.assert_qmp(result, 'return[0]/ready', False)
+ self.vm.qtest(f'clock_step {4 * 1000 * 1000 * 1000}')
+ time.sleep(1) # in real time, the rest should now comlpete fast
I think the clock_step belongs on the export side, the QSD. On the
other hand, QSD has no way to enable qtest, I believe, so it won’t work
well as an export here. I think it works accidentally because throttle
allows a burst, and can allow to write 3 MB in 2 seconds.
This whole test is also a bit fiddly. It needs to write 3 MB in one
second, I believe, which seems prone to being flakey. I’d be happy with
a null export on the target side, if that still did the job (pun intended).
(Also *complete)
Hanna
+ result = self.vm.qmp('query-block-jobs')
+ self.assert_qmp(result, 'return[0]/ready', True)
+
+ self.complete_and_wait('mirror')
+ self.vm.shutdown()
+ self.qsd.stop()
+ self.assertTrue(iotests.compare_images(test_img, target_img),
+ 'target image does not match source after mirroring')
+
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'],
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
index 46651953e8..5273ce86c3 100644
--- a/tests/qemu-iotests/041.out
+++ b/tests/qemu-iotests/041.out
@@ -1,5 +1,5 @@
-...........................................................................................................
+............................................................................................................
----------------------------------------------------------------------
-Ran 107 tests
+Ran 108 tests
OK