aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/030
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qemu-iotests/030')
-rwxr-xr-xtests/qemu-iotests/030168
1 files changed, 62 insertions, 106 deletions
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 98595d47fe..0e6a39d103 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -56,8 +56,7 @@ class TestSingleDrive(iotests.QMPTestCase):
def test_stream(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
self.wait_until_completed()
@@ -77,8 +76,7 @@ class TestSingleDrive(iotests.QMPTestCase):
qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', mid_img).stdout,
'image file map matches backing file before streaming')
- result = self.vm.qmp('block-stream', device='mid', job_id='stream-mid')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='mid', job_id='stream-mid')
self.wait_until_completed(drive='stream-mid')
@@ -94,8 +92,7 @@ class TestSingleDrive(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
self.vm.pause_drive('drive0')
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
self.pause_job('drive0', wait=False)
self.vm.resume_drive('drive0')
@@ -108,8 +105,7 @@ class TestSingleDrive(iotests.QMPTestCase):
result = self.vm.qmp('query-block-jobs')
self.assert_qmp(result, 'return[0]/offset', offset)
- result = self.vm.qmp('block-job-resume', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-resume', device='drive0')
self.wait_until_completed()
@@ -129,8 +125,7 @@ class TestSingleDrive(iotests.QMPTestCase):
'-f', iotests.imgfmt, '-rU', '-c', 'map', test_img).stdout
# This is a no-op: no data should ever be copied from the base image
- result = self.vm.qmp('block-stream', device='drive0', base=mid_img)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', base=mid_img)
self.wait_until_completed()
@@ -144,8 +139,7 @@ class TestSingleDrive(iotests.QMPTestCase):
def test_stream_partial(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0', base=backing_img)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', base=backing_img)
self.wait_until_completed()
@@ -172,24 +166,22 @@ class TestSingleDrive(iotests.QMPTestCase):
qemu_img('create', '-f', iotests.imgfmt, ro_top_path,
str(self.image_len))
- result = self.vm.qmp('blockdev-add',
- node_name='ro-top',
- driver=iotests.imgfmt,
- read_only=True,
- file={
- 'driver': 'file',
- 'filename': ro_top_path,
- 'read-only': True
- },
- backing='mid')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-add',
+ node_name='ro-top',
+ driver=iotests.imgfmt,
+ read_only=True,
+ file={
+ 'driver': 'file',
+ 'filename': ro_top_path,
+ 'read-only': True
+ },
+ backing='mid')
result = self.vm.qmp('block-stream', job_id='stream',
device='ro-top', base_node='base')
self.assert_qmp(result, 'error/desc', 'Block node is read-only')
- result = self.vm.qmp('blockdev-del', node_name='ro-top')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-del', node_name='ro-top')
class TestParallelOps(iotests.QMPTestCase):
@@ -254,10 +246,9 @@ class TestParallelOps(iotests.QMPTestCase):
node_name = 'node%d' % i
job_id = 'stream-%s' % node_name
pending_jobs.append(job_id)
- result = self.vm.qmp('block-stream', device=node_name,
- job_id=job_id, bottom=f'node{i-1}',
- speed=1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device=node_name,
+ job_id=job_id, bottom=f'node{i-1}',
+ speed=1024)
# Do this in reverse: After unthrottling them, some jobs may finish
# before we have unthrottled all of them. This will drain their
@@ -269,8 +260,7 @@ class TestParallelOps(iotests.QMPTestCase):
# Starting from the top (i.e. in reverse) does not have this problem:
# When a job finishes, the ones below it are not advanced.
for job in reversed(pending_jobs):
- result = self.vm.qmp('block-job-set-speed', device=job, speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device=job, speed=0)
# Wait for all jobs to be finished.
while len(pending_jobs) > 0:
@@ -297,10 +287,9 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Set a speed limit to make sure that this job blocks the rest
- result = self.vm.qmp('block-stream', device='node4',
- job_id='stream-node4', base=self.imgs[1],
- filter_node_name='stream-filter', speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='node4',
+ job_id='stream-node4', base=self.imgs[1],
+ filter_node_name='stream-filter', speed=1024*1024)
result = self.vm.qmp('block-stream', device='node5', job_id='stream-node5', base=self.imgs[2])
self.assert_qmp(result, 'error/desc',
@@ -328,8 +317,7 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_qmp(result, 'error/desc',
"Node 'node2' is busy: block device is in use by block job: stream")
- result = self.vm.qmp('block-job-set-speed', device='stream-node4', speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='stream-node4', speed=0)
self.wait_until_completed(drive='stream-node4')
self.assert_no_active_block_jobs()
@@ -341,8 +329,7 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Set a speed limit to make sure that this job blocks the rest
- result = self.vm.qmp('block-commit', device='drive0', top=self.imgs[5], base=self.imgs[3], job_id='commit-node3', speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-commit', device='drive0', top=self.imgs[5], base=self.imgs[3], job_id='commit-node3', speed=1024*1024)
result = self.vm.qmp('block-stream', device='node3', job_id='stream-node3')
self.assert_qmp(result, 'error/desc',
@@ -365,8 +352,7 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_qmp(result, 'error/desc',
"Node 'drive0' is busy: block device is in use by block job: commit")
- result = self.vm.qmp('block-job-set-speed', device='commit-node3', speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='commit-node3', speed=0)
self.wait_until_completed(drive='commit-node3')
@@ -377,23 +363,20 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Set a speed limit to make sure that this job blocks the rest
- result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[3], job_id='commit-drive0', speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-commit', device='drive0', base=self.imgs[3], job_id='commit-drive0', speed=1024*1024)
result = self.vm.qmp('block-stream', device='node5', base=self.imgs[3], job_id='stream-node6')
self.assert_qmp(result, 'error/desc',
"Node 'node5' is busy: block device is in use by block job: commit")
- result = self.vm.qmp('block-job-set-speed', device='commit-drive0', speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='commit-drive0', speed=0)
event = self.vm.event_wait(name='BLOCK_JOB_READY')
self.assert_qmp(event, 'data/device', 'commit-drive0')
self.assert_qmp(event, 'data/type', 'commit')
self.assert_qmp_absent(event, 'data/error')
- result = self.vm.qmp('block-job-complete', device='commit-drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-complete', device='commit-drive0')
self.wait_until_completed(drive='commit-drive0')
@@ -404,18 +387,16 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Commit from node2 into node0
- result = self.vm.qmp('block-commit', device='drive0',
- top=self.imgs[2], base=self.imgs[0],
- filter_node_name='commit-filter', speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-commit', device='drive0',
+ top=self.imgs[2], base=self.imgs[0],
+ filter_node_name='commit-filter', speed=1024*1024)
# Stream from node2 into node4
result = self.vm.qmp('block-stream', device='node4', base_node='node2', job_id='node4')
self.assert_qmp(result, 'error/desc',
"Cannot freeze 'backing' link to 'commit-filter'")
- result = self.vm.qmp('block-job-set-speed', device='drive0', speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='drive0', speed=0)
self.wait_until_completed()
self.assert_no_active_block_jobs()
@@ -428,18 +409,15 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Commit from node2 into node0
- result = self.vm.qmp('block-commit', device='drive0',
- top_node='node2', base_node='node0',
- filter_node_name='commit-filter', speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-commit', device='drive0',
+ top_node='node2', base_node='node0',
+ filter_node_name='commit-filter', speed=1024*1024)
# Stream from node2 into node4
- result = self.vm.qmp('block-stream', device='node4',
- base_node='commit-filter', job_id='node4')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='node4',
+ base_node='commit-filter', job_id='node4')
- result = self.vm.qmp('block-job-set-speed', device='drive0', speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='drive0', speed=0)
self.vm.run_job(job='drive0', auto_dismiss=True)
self.vm.run_job(job='node4', auto_dismiss=True)
@@ -458,12 +436,10 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Stream from node0 into node2
- result = self.vm.qmp('block-stream', device='node2', base_node='node0', job_id='node2')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='node2', base_node='node0', job_id='node2')
# Commit from the active layer into node3
- result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[3])
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-commit', device='drive0', base=self.imgs[3])
# Wait for all jobs to be finished.
pending_jobs = ['node2', 'drive0']
@@ -490,16 +466,13 @@ class TestParallelOps(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
# Stream from node0 into node4
- result = self.vm.qmp('block-stream', device='node4', base_node='node0', job_id='node4', speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='node4', base_node='node0', job_id='node4', speed=1024*1024)
# Commit from the active layer into node5
- result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[5], speed=1024*1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-commit', device='drive0', base=self.imgs[5], speed=1024*1024)
for job in ['drive0', 'node4']:
- result = self.vm.qmp('block-job-set-speed', device=job, speed=0)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device=job, speed=0)
# Wait for all jobs to be finished.
pending_jobs = ['node4', 'drive0']
@@ -549,8 +522,7 @@ class TestParallelOps(iotests.QMPTestCase):
"'base' and 'base-node' cannot be specified at the same time")
# Success: the base node is a backing file of the top node
- result = self.vm.qmp('block-stream', device='node4', base_node='node2', job_id='stream')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='node4', base_node='node2', job_id='stream')
self.wait_until_completed(drive='stream')
@@ -606,8 +578,7 @@ class TestQuorum(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='node0', job_id='stream-node0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='node0', job_id='stream-node0')
self.wait_until_completed(drive='stream-node0')
@@ -636,8 +607,7 @@ class TestSmallerBackingFile(iotests.QMPTestCase):
def test_stream(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
self.wait_until_completed()
@@ -694,8 +664,7 @@ class TestEIO(TestErrors):
def test_report(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
completed = False
error = False
@@ -722,8 +691,7 @@ class TestEIO(TestErrors):
def test_ignore(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0', on_error='ignore')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', on_error='ignore')
error = False
completed = False
@@ -756,8 +724,7 @@ class TestEIO(TestErrors):
def test_stop(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0', on_error='stop')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', on_error='stop')
error = False
completed = False
@@ -779,8 +746,7 @@ class TestEIO(TestErrors):
self.assert_qmp(result, 'return[0]/offset', self.STREAM_BUFFER_SIZE)
self.assert_qmp(result, 'return[0]/io-status', 'failed')
- result = self.vm.qmp('block-job-resume', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-resume', device='drive0')
result = self.vm.qmp('query-block-jobs')
if result == {'return': []}:
@@ -806,8 +772,7 @@ class TestEIO(TestErrors):
def test_enospc(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0', on_error='enospc')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', on_error='enospc')
completed = False
error = False
@@ -852,8 +817,7 @@ class TestENOSPC(TestErrors):
def test_enospc(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0', on_error='enospc')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', on_error='enospc')
error = False
completed = False
@@ -875,8 +839,7 @@ class TestENOSPC(TestErrors):
self.assert_qmp(result, 'return[0]/offset', self.STREAM_BUFFER_SIZE)
self.assert_qmp(result, 'return[0]/io-status', 'nospace')
- result = self.vm.qmp('block-job-resume', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-resume', device='drive0')
result = self.vm.qmp('query-block-jobs')
if result == {'return': []}:
@@ -921,8 +884,7 @@ class TestStreamStop(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
self.vm.pause_drive('drive0')
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
time.sleep(0.1)
events = self.vm.get_qmp_events(wait=False)
@@ -955,11 +917,9 @@ class TestSetSpeed(iotests.QMPTestCase):
def perf_test_throughput(self):
self.assert_no_active_block_jobs()
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
- result = self.vm.qmp('block-job-set-speed', device='drive0', speed=8 * 1024 * 1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='drive0', speed=8 * 1024 * 1024)
self.wait_until_completed()
@@ -969,16 +929,14 @@ class TestSetSpeed(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
self.vm.pause_drive('drive0')
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
# Default speed is 0
result = self.vm.qmp('query-block-jobs')
self.assert_qmp(result, 'return[0]/device', 'drive0')
self.assert_qmp(result, 'return[0]/speed', 0)
- result = self.vm.qmp('block-job-set-speed', device='drive0', speed=8 * 1024 * 1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-set-speed', device='drive0', speed=8 * 1024 * 1024)
# Ensure the speed we set was accepted
result = self.vm.qmp('query-block-jobs')
@@ -989,8 +947,7 @@ class TestSetSpeed(iotests.QMPTestCase):
self.vm.pause_drive('drive0')
# Check setting speed in block-stream works
- result = self.vm.qmp('block-stream', device='drive0', speed=4 * 1024 * 1024)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0', speed=4 * 1024 * 1024)
result = self.vm.qmp('query-block-jobs')
self.assert_qmp(result, 'return[0]/device', 'drive0')
@@ -1007,8 +964,7 @@ class TestSetSpeed(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
self.vm.pause_drive('drive0')
- result = self.vm.qmp('block-stream', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-stream', device='drive0')
result = self.vm.qmp('block-job-set-speed', device='drive0', speed=-1)
self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value")