Skip to content

Commit

Permalink
iotests/264: add backup-cancel test-case
Browse files Browse the repository at this point in the history
Check that cancel doesn't wait for 10s of nbd reconnect timeout.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210205163720.887197-11-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and ebblake committed Feb 12, 2021
1 parent ff789bf commit 594427f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 14 additions & 7 deletions tests/qemu-iotests/264
Expand Up @@ -94,13 +94,7 @@ class TestNbdReconnect(iotests.QMPTestCase):
result = self.vm.qmp('blockdev-del', node_name='backup0')
self.assert_qmp(result, 'return', {})

def test_mirror_cancel(self):
# Mirror speed limit doesn't work well enough, it seems that mirror
# will run many parallel requests anyway. MAX_IN_FLIGHT is 16 and
# MAX_IO_BYTES is 1M in mirror.c, so let's use 20M disk.
self.init_vm(20 * 1024 * 1024)
self.start_job('blockdev-mirror')

def cancel_job(self):
result = self.vm.qmp('block-job-cancel', device='drive0')
self.assert_qmp(result, 'return', {})

Expand All @@ -109,6 +103,19 @@ class TestNbdReconnect(iotests.QMPTestCase):
delta_t = time.time() - start_t
self.assertTrue(delta_t < 2.0)

def test_mirror_cancel(self):
# Mirror speed limit doesn't work well enough, it seems that mirror
# will run many parallel requests anyway. MAX_IN_FLIGHT is 16 and
# MAX_IO_BYTES is 1M in mirror.c, so let's use 20M disk.
self.init_vm(20 * 1024 * 1024)
self.start_job('blockdev-mirror')
self.cancel_job()

def test_backup_cancel(self):
self.init_vm(5 * 1024 * 1024)
self.start_job('blockdev-backup')
self.cancel_job()


if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
4 changes: 2 additions & 2 deletions tests/qemu-iotests/264.out
@@ -1,5 +1,5 @@
..
...
----------------------------------------------------------------------
Ran 2 tests
Ran 3 tests

OK

0 comments on commit 594427f

Please sign in to comment.