aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/139
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-10-06 18:41:25 +0300
committerJohn Snow <jsnow@redhat.com>2023-10-12 14:21:44 -0400
commitb6aed193e5ecca32bb07e062f58f0daca06e7009 (patch)
tree869a1bf90b35f8bff095472c3c9f9ccd5631fe26 /tests/qemu-iotests/139
parent25ad2cf6500db3b7f2d88de448791183d7614097 (diff)
downloadqemu-b6aed193e5ecca32bb07e062f58f0daca06e7009.zip
qemu-b6aed193e5ecca32bb07e062f58f0daca06e7009.tar.gz
qemu-b6aed193e5ecca32bb07e062f58f0daca06e7009.tar.bz2
python: use vm.cmd() instead of vm.qmp() where appropriate
In many cases we just want an effect of qmp command and want to raise on failure. Use vm.cmd() method which does exactly this. The commit is generated by command git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py And then, fix self.assertRaises to expect ExecuteError exception in tests/qemu-iotests/124 Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20231006154125.1068348-16-vsementsov@yandex-team.ru Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/139')
-rwxr-xr-xtests/qemu-iotests/13945
1 files changed, 16 insertions, 29 deletions
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
index 178b1ee..ebb4cd6 100755
--- a/tests/qemu-iotests/139
+++ b/tests/qemu-iotests/139
@@ -58,8 +58,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'file': {'driver': 'file',
'node-name': file_node,
'filename': base_img}}
- result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-add', conv_keys = False, **opts)
self.checkBlockDriverState(node)
self.checkBlockDriverState(file_node)
@@ -73,8 +72,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'backing': None,
'file': {'driver': 'file',
'filename': new_img}}
- result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-add', conv_keys = False, **opts)
self.checkBlockDriverState(node)
# Delete a BlockDriverState
@@ -89,17 +87,14 @@ class TestBlockdevDel(iotests.QMPTestCase):
# Add a device model
def addDeviceModel(self, device, backend, driver = 'virtio-blk'):
- result = self.vm.qmp('device_add', id = device,
- driver = driver, drive = backend)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('device_add', id = device,
+ driver = driver, drive = backend)
# Delete a device model
def delDeviceModel(self, device, is_virtio_blk = True):
- result = self.vm.qmp('device_del', id = device)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('device_del', id = device)
- result = self.vm.qmp('system_reset')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('system_reset')
if is_virtio_blk:
device_path = '/machine/peripheral/%s/virtio-backend' % device
@@ -126,9 +121,8 @@ class TestBlockdevDel(iotests.QMPTestCase):
# Insert a BlockDriverState
def insertDrive(self, device, node):
self.checkBlockDriverState(node)
- result = self.vm.qmp('blockdev-insert-medium',
- id = device, node_name = node)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-insert-medium',
+ id = device, node_name = node)
self.checkBlockDriverState(node)
# Create a snapshot using 'blockdev-snapshot-sync'
@@ -139,8 +133,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'snapshot-file': new_img,
'snapshot-node-name': overlay,
'format': iotests.imgfmt}
- result = self.vm.qmp('blockdev-snapshot-sync', conv_keys=False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-snapshot-sync', conv_keys=False, **opts)
self.checkBlockDriverState(node)
self.checkBlockDriverState(overlay)
@@ -148,9 +141,8 @@ class TestBlockdevDel(iotests.QMPTestCase):
def createSnapshot(self, node, overlay):
self.checkBlockDriverState(node)
self.checkBlockDriverState(overlay)
- result = self.vm.qmp('blockdev-snapshot',
- node = node, overlay = overlay)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-snapshot',
+ node = node, overlay = overlay)
self.checkBlockDriverState(node)
self.checkBlockDriverState(overlay)
@@ -163,14 +155,12 @@ class TestBlockdevDel(iotests.QMPTestCase):
'node-name': new_node,
'sync': 'top',
'format': iotests.imgfmt}
- result = self.vm.qmp('drive-mirror', conv_keys=False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('drive-mirror', conv_keys=False, **opts)
self.checkBlockDriverState(new_node)
# Complete an existing block job
def completeBlockJob(self, id, node_before, node_after):
- result = self.vm.qmp('block-job-complete', device=id)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('block-job-complete', device=id)
self.wait_until_completed(id)
# Add a BlkDebug node
@@ -186,8 +176,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
opts = {'driver': 'blkdebug',
'node-name': debug,
'image': image}
- result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-add', conv_keys = False, **opts)
self.checkBlockDriverState(node)
self.checkBlockDriverState(debug)
@@ -211,8 +200,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'node-name': blkverify,
'test': node_0,
'raw': node_1}
- result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-add', conv_keys = False, **opts)
self.checkBlockDriverState(test)
self.checkBlockDriverState(raw)
self.checkBlockDriverState(blkverify)
@@ -235,8 +223,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'node-name': quorum,
'vote-threshold': 1,
'children': [ child_0, child_1 ]}
- result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('blockdev-add', conv_keys = False, **opts)
self.checkBlockDriverState(child0)
self.checkBlockDriverState(child1)
self.checkBlockDriverState(quorum)