mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
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>
This commit is contained in:
parent
25ad2cf650
commit
b6aed193e5
44 changed files with 974 additions and 1448 deletions
|
@ -80,25 +80,23 @@ class TestPreallocateFilter(TestPreallocateBase):
|
|||
def test_external_snapshot(self):
|
||||
self.test_prealloc()
|
||||
|
||||
result = self.vm.qmp('blockdev-snapshot-sync', node_name='disk',
|
||||
snapshot_file=overlay,
|
||||
snapshot_node_name='overlay')
|
||||
self.assert_qmp(result, 'return', {})
|
||||
self.vm.cmd('blockdev-snapshot-sync', node_name='disk',
|
||||
snapshot_file=overlay,
|
||||
snapshot_node_name='overlay')
|
||||
|
||||
# on reopen to r-o base preallocation should be dropped
|
||||
self.check_small()
|
||||
|
||||
self.vm.hmp_qemu_io('drive0', 'write 1M 1M')
|
||||
|
||||
result = self.vm.qmp('block-commit', device='overlay')
|
||||
self.assert_qmp(result, 'return', {})
|
||||
self.vm.cmd('block-commit', device='overlay')
|
||||
self.complete_and_wait()
|
||||
|
||||
# commit of new megabyte should trigger preallocation
|
||||
self.check_big()
|
||||
|
||||
def test_reopen_opts(self):
|
||||
result = self.vm.qmp('blockdev-reopen', options=[{
|
||||
self.vm.cmd('blockdev-reopen', options=[{
|
||||
'node-name': 'disk',
|
||||
'driver': iotests.imgfmt,
|
||||
'file': {
|
||||
|
@ -113,7 +111,6 @@ class TestPreallocateFilter(TestPreallocateBase):
|
|||
}
|
||||
}
|
||||
}])
|
||||
self.assert_qmp(result, 'return', {})
|
||||
|
||||
self.vm.hmp_qemu_io('drive0', 'write 0 1M')
|
||||
self.assertTrue(os.path.getsize(disk) == 25 * MiB)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue