iotests: drop some extra ** in qmp() call

qmp() method supports passing dict (if it doesn't need substituting
'_' to '-' in keys). So, drop some extra '**' operators.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20231006154125.1068348-12-vsementsov@yandex-team.ru
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2023-10-06 18:41:21 +03:00 committed by John Snow
parent 1ada73fbea
commit c5339030e6
10 changed files with 54 additions and 56 deletions

View file

@ -774,7 +774,7 @@ class TestCommitWithFilters(iotests.QMPTestCase):
result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg') result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp('blockdev-add', **{ result = self.vm.qmp('blockdev-add', {
'node-name': 'top-filter', 'node-name': 'top-filter',
'driver': 'throttle', 'driver': 'throttle',
'throttle-group': 'tg', 'throttle-group': 'tg',
@ -935,7 +935,7 @@ class TestCommitWithOverriddenBacking(iotests.QMPTestCase):
self.vm.launch() self.vm.launch()
# Use base_b instead of base_a as the backing of top # Use base_b instead of base_a as the backing of top
result = self.vm.qmp('blockdev-add', **{ result = self.vm.qmp('blockdev-add', {
'node-name': 'top', 'node-name': 'top',
'driver': iotests.imgfmt, 'driver': iotests.imgfmt,
'file': { 'file': {

View file

@ -236,7 +236,7 @@ class TestSingleBlockdev(TestSingleDrive):
args = {'driver': iotests.imgfmt, args = {'driver': iotests.imgfmt,
'node-name': self.qmp_target, 'node-name': self.qmp_target,
'file': { 'filename': target_img, 'driver': 'file' } } 'file': { 'filename': target_img, 'driver': 'file' } }
result = self.vm.qmp("blockdev-add", **args) result = self.vm.qmp("blockdev-add", args)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
def test_mirror_to_self(self): def test_mirror_to_self(self):
@ -963,7 +963,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
#assemble the quorum block device from the individual files #assemble the quorum block device from the individual files
args = { "driver": "quorum", "node-name": "quorum0", args = { "driver": "quorum", "node-name": "quorum0",
"vote-threshold": 2, "children": [ "img0", "img1", "img2" ] } "vote-threshold": 2, "children": [ "img0", "img1", "img2" ] }
result = self.vm.qmp("blockdev-add", **args) result = self.vm.qmp("blockdev-add", args)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
@ -1278,7 +1278,7 @@ class TestReplaces(iotests.QMPTestCase):
""" """
Check that we can replace filter nodes. Check that we can replace filter nodes.
""" """
result = self.vm.qmp('blockdev-add', **{ result = self.vm.qmp('blockdev-add', {
'driver': 'copy-on-read', 'driver': 'copy-on-read',
'node-name': 'filter0', 'node-name': 'filter0',
'file': { 'file': {
@ -1319,7 +1319,7 @@ class TestFilters(iotests.QMPTestCase):
self.vm = iotests.VM().add_device('virtio-scsi,id=vio-scsi') self.vm = iotests.VM().add_device('virtio-scsi,id=vio-scsi')
self.vm.launch() self.vm.launch()
result = self.vm.qmp('blockdev-add', **{ result = self.vm.qmp('blockdev-add', {
'node-name': 'target', 'node-name': 'target',
'driver': iotests.imgfmt, 'driver': iotests.imgfmt,
'file': { 'file': {
@ -1355,7 +1355,7 @@ class TestFilters(iotests.QMPTestCase):
os.remove(backing_img) os.remove(backing_img)
def test_cor(self): def test_cor(self):
result = self.vm.qmp('blockdev-add', **{ result = self.vm.qmp('blockdev-add', {
'node-name': 'filter', 'node-name': 'filter',
'driver': 'copy-on-read', 'driver': 'copy-on-read',
'file': self.filterless_chain 'file': self.filterless_chain
@ -1384,7 +1384,7 @@ class TestFilters(iotests.QMPTestCase):
assert target_map[1]['depth'] == 0 assert target_map[1]['depth'] == 0
def test_implicit_mirror_filter(self): def test_implicit_mirror_filter(self):
result = self.vm.qmp('blockdev-add', **self.filterless_chain) result = self.vm.qmp('blockdev-add', self.filterless_chain)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
# We need this so we can query from above the mirror node # We need this so we can query from above the mirror node
@ -1418,7 +1418,7 @@ class TestFilters(iotests.QMPTestCase):
def test_explicit_mirror_filter(self): def test_explicit_mirror_filter(self):
# Same test as above, but this time we give the mirror filter # Same test as above, but this time we give the mirror filter
# a node-name so it will not be invisible # a node-name so it will not be invisible
result = self.vm.qmp('blockdev-add', **self.filterless_chain) result = self.vm.qmp('blockdev-add', self.filterless_chain)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
# We need this so we can query from above the mirror node # We need this so we can query from above the mirror node

View file

@ -87,7 +87,7 @@ class TestStopWithBlockJob(iotests.QMPTestCase):
iotests.qemu_img('create', '-f', iotests.imgfmt, self.overlay_img, iotests.qemu_img('create', '-f', iotests.imgfmt, self.overlay_img,
'1G') '1G')
result = self.vm.qmp('blockdev-add', **{ result = self.vm.qmp('blockdev-add', {
'node-name': 'overlay', 'node-name': 'overlay',
'driver': iotests.imgfmt, 'driver': iotests.imgfmt,
'file': { 'file': {

View file

@ -58,7 +58,7 @@ class NBDBlockdevAddBase(iotests.QMPTestCase):
def client_test(self, filename, address, export=None, def client_test(self, filename, address, export=None,
node_name='nbd-blockdev', delete=True): node_name='nbd-blockdev', delete=True):
bao = self.blockdev_add_options(address, export, node_name) bao = self.blockdev_add_options(address, export, node_name)
result = self.vm.qmp('blockdev-add', **bao) result = self.vm.qmp('blockdev-add', bao)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
found = False found = False

View file

@ -110,7 +110,7 @@ class BaseClass(iotests.QMPTestCase):
elif self.target_blockdev_backing: elif self.target_blockdev_backing:
options['backing'] = self.target_blockdev_backing options['backing'] = self.target_blockdev_backing
result = self.vm.qmp('blockdev-add', **options) result = self.vm.qmp('blockdev-add', options)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
def tearDown(self): def tearDown(self):

View file

@ -49,12 +49,12 @@ class TestNbdReconnect(iotests.QMPTestCase):
assert job in ('blockdev-backup', 'blockdev-mirror') assert job in ('blockdev-backup', 'blockdev-mirror')
with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b): with qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b):
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
**{'node_name': 'backup0', {'node-name': 'backup0',
'driver': 'raw', 'driver': 'raw',
'file': {'driver': 'nbd', 'file': {'driver': 'nbd',
'server': {'type': 'unix', 'server': {'type': 'unix',
'path': nbd_sock}, 'path': nbd_sock},
'reconnect-delay': 10}}) 'reconnect-delay': 10}})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp(job, device='drive0', result = self.vm.qmp(job, device='drive0',
sync='full', target='backup0', sync='full', target='backup0',

View file

@ -102,8 +102,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
} }
} }
result = self.vm.qmp('blockdev-add', ** result = self.vm.qmp('blockdev-add', {
{
'driver': iotests.imgfmt, 'driver': iotests.imgfmt,
'node-name': id, 'node-name': id,
'read-only': read_only, 'read-only': read_only,
@ -120,7 +119,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
# close the encrypted block device # close the encrypted block device
def closeImageQmp(self, id): def closeImageQmp(self, id):
result = self.vm.qmp('blockdev-del', **{ 'node-name': id }) result = self.vm.qmp('blockdev-del', {'node-name': id})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
########################################################################### ###########################################################################

View file

@ -42,7 +42,7 @@ class Secret:
return [ "secret,id=" + self._id + ",data=" + self._secret] return [ "secret,id=" + self._id + ",data=" + self._secret]
def to_qmp_object(self): def to_qmp_object(self):
return { "qom_type" : "secret", "id": self.id(), return { "qom-type" : "secret", "id": self.id(),
"data": self.secret() } "data": self.secret() }
################################################################################ ################################################################################
@ -61,9 +61,9 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
# create the secrets and load 'em into the VMs # create the secrets and load 'em into the VMs
self.secrets = [ Secret(i) for i in range(0, 4) ] self.secrets = [ Secret(i) for i in range(0, 4) ]
for secret in self.secrets: for secret in self.secrets:
result = self.vm1.qmp("object-add", **secret.to_qmp_object()) result = self.vm1.qmp("object-add", secret.to_qmp_object())
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm2.qmp("object-add", **secret.to_qmp_object()) result = self.vm2.qmp("object-add", secret.to_qmp_object())
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
# test case shutdown # test case shutdown
@ -135,15 +135,14 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
result = vm.qmp(command, options=[opts]) result = vm.qmp(command, options=[opts])
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
else: else:
result = vm.qmp(command, **opts) result = vm.qmp(command, opts)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
########################################################################### ###########################################################################
# add virtio-blk consumer for a block device # add virtio-blk consumer for a block device
def addImageUser(self, vm, id, disk_id, share_rw=False): def addImageUser(self, vm, id, disk_id, share_rw=False):
result = vm.qmp('device_add', ** result = vm.qmp('device_add', {
{
'driver': 'virtio-blk', 'driver': 'virtio-blk',
'id': id, 'id': id,
'drive': disk_id, 'drive': disk_id,
@ -155,7 +154,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
# close the encrypted block device # close the encrypted block device
def closeImageQmp(self, vm, id): def closeImageQmp(self, vm, id):
result = vm.qmp('blockdev-del', **{ 'node-name': id }) result = vm.qmp('blockdev-del', {'node-name': id})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
########################################################################### ###########################################################################
@ -174,7 +173,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
}, },
} }
result = vm.qmp('x-blockdev-amend', **args) result = vm.qmp('x-blockdev-amend', args)
iotests.log(result) iotests.log(result)
# Run the job only if it was created # Run the job only if it was created
event = ('JOB_STATUS_CHANGE', event = ('JOB_STATUS_CHANGE',

View file

@ -67,7 +67,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase):
if persistent: if persistent:
params['persistent'] = True params['persistent'] = True
result = vm.qmp('block-dirty-bitmap-add', **params) result = vm.qmp('block-dirty-bitmap-add', params)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
def check_bitmap(self, vm, sha256): def check_bitmap(self, vm, sha256):
@ -256,7 +256,7 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestCase):
self.vm = iotests.VM() self.vm = iotests.VM()
self.vm.launch() self.vm.launch()
result = self.vm.qmp('blockdev-add', **blockdev) result = self.vm.qmp('blockdev-add', blockdev)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
# Check that the bitmaps are there # Check that the bitmaps are there

View file

@ -49,12 +49,12 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase):
def add_blockdevs(self, once: bool) -> None: def add_blockdevs(self, once: bool) -> None:
res = self.vm.qmp('blockdev-add', res = self.vm.qmp('blockdev-add',
**{'node-name': 'source', {'node-name': 'source',
'driver': iotests.imgfmt, 'driver': iotests.imgfmt,
'file': { 'file': {
'driver': 'file', 'driver': 'file',
'filename': source 'filename': source
}}) }})
self.assert_qmp(res, 'return', {}) self.assert_qmp(res, 'return', {})
# blkdebug notes: # blkdebug notes:
@ -63,25 +63,25 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase):
# when the job is about to complete, and we want that one to # when the job is about to complete, and we want that one to
# fail. # fail.
res = self.vm.qmp('blockdev-add', res = self.vm.qmp('blockdev-add',
**{'node-name': 'target', {'node-name': 'target',
'driver': iotests.imgfmt, 'driver': iotests.imgfmt,
'file': { 'file': {
'driver': 'blkdebug', 'driver': 'blkdebug',
'image': { 'image': {
'driver': 'file', 'driver': 'file',
'filename': target 'filename': target
}, },
'set-state': [{ 'set-state': [{
'event': 'flush_to_disk', 'event': 'flush_to_disk',
'state': 1, 'state': 1,
'new_state': 2 'new_state': 2
}], }],
'inject-error': [{ 'inject-error': [{
'event': 'flush_to_disk', 'event': 'flush_to_disk',
'once': once, 'once': once,
'immediately': True, 'immediately': True,
'state': 2 'state': 2
}]}}) }]}})
self.assert_qmp(res, 'return', {}) self.assert_qmp(res, 'return', {})
def start_mirror(self) -> None: def start_mirror(self) -> None: