block: Remove "options" indirection from blockdev-add

Now that QAPI supports boxed types, we can have unions at the top level
of a command, so let's put our real options directly there for
blockdev-add instead of having a single "options" dict that contains the
real arguments.

blockdev-add is still experimental and we already made substantial
changes to the API recently, so we're free to make changes like this
one, too.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Kevin Wolf 2016-10-07 17:05:04 +02:00
parent 170f4b2e5c
commit 0153d2f50b
14 changed files with 214 additions and 259 deletions

View File

@ -1090,11 +1090,11 @@ Arguments:
Example: Example:
-> { "execute": "blockdev-add", -> { "execute": "blockdev-add",
"arguments": { "options": { "driver": "qcow2", "arguments": { "driver": "qcow2",
"node-name": "node1534", "node-name": "node1534",
"file": { "driver": "file", "file": { "driver": "file",
"filename": "hd1.qcow2" }, "filename": "hd1.qcow2" },
"backing": "" } } } "backing": "" } }
<- { "return": {} } <- { "return": {} }
@ -3130,23 +3130,20 @@ This command is still a work in progress. It doesn't support all
block drivers among other things. Stay away from it unless you want block drivers among other things. Stay away from it unless you want
to help with its development. to help with its development.
Arguments: For the arguments, see the QAPI schema documentation of BlockdevOptions.
- "options": block driver options
Example (1): Example (1):
-> { "execute": "blockdev-add", -> { "execute": "blockdev-add",
"arguments": { "options" : { "driver": "qcow2", "arguments": { "driver": "qcow2",
"file": { "driver": "file", "file": { "driver": "file",
"filename": "test.qcow2" } } } } "filename": "test.qcow2" } } }
<- { "return": {} } <- { "return": {} }
Example (2): Example (2):
-> { "execute": "blockdev-add", -> { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "qcow2", "driver": "qcow2",
"node-name": "my_disk", "node-name": "my_disk",
"discard": "unmap", "discard": "unmap",
@ -3167,7 +3164,6 @@ Example (2):
} }
} }
} }
}
<- { "return": {} } <- { "return": {} }
@ -3191,7 +3187,6 @@ Example:
-> { "execute": "blockdev-add", -> { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "qcow2", "driver": "qcow2",
"node-name": "node0", "node-name": "node0",
"file": { "file": {
@ -3200,7 +3195,6 @@ Example:
} }
} }
} }
}
<- { "return": {} } <- { "return": {} }
@ -3342,10 +3336,10 @@ Arguments:
Example: Example:
-> { "execute": "blockdev-add", -> { "execute": "blockdev-add",
"arguments": { "options": { "node-name": "node0", "arguments": { { "node-name": "node0",
"driver": "raw", "driver": "raw",
"file": { "driver": "file", "file": { "driver": "file",
"filename": "fedora.iso" } } } } "filename": "fedora.iso" } } }
<- { "return": {} } <- { "return": {} }
@ -3383,10 +3377,10 @@ Example:
Add a new node to a quorum Add a new node to a quorum
-> { "execute": "blockdev-add", -> { "execute": "blockdev-add",
"arguments": { "options": { "driver": "raw", "arguments": { "driver": "raw",
"node-name": "new_node", "node-name": "new_node",
"file": { "driver": "file", "file": { "driver": "file",
"filename": "test.raw" } } } } "filename": "test.raw" } } }
<- { "return": {} } <- { "return": {} }
-> { "execute": "x-blockdev-change", -> { "execute": "x-blockdev-change",
"arguments": { "parent": "disk1", "arguments": { "parent": "disk1",

View File

@ -2312,11 +2312,11 @@
# block drivers among other things. Stay away from it unless you want # block drivers among other things. Stay away from it unless you want
# to help with its development. # to help with its development.
# #
# @options: block device options for the new device # For the arguments, see the documentation of BlockdevOptions.
# #
# Since: 1.7 # Since: 1.7
## ##
{ 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } } { 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
## ##
# @x-blockdev-del: # @x-blockdev-del:

View File

@ -194,10 +194,9 @@ class TestSingleBlockdev(TestSingleDrive):
def setUp(self): def setUp(self):
TestSingleDrive.setUp(self) TestSingleDrive.setUp(self)
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img)
args = {'options': args = {'driver': iotests.imgfmt,
{'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', {})
@ -782,8 +781,8 @@ class TestRepairQuorum(iotests.QMPTestCase):
self.vm.launch() self.vm.launch()
#assemble the quorum block device from the individual files #assemble the quorum block device from the individual files
args = { "options" : { "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" ] }
if self.has_quorum(): if self.has_quorum():
result = self.vm.qmp("blockdev-add", **args) result = self.vm.qmp("blockdev-add", **args)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})

View File

@ -119,7 +119,6 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "disk", "node-name": "disk",
"file": { "file": {
@ -128,7 +127,6 @@ run_qemu <<EOF
} }
} }
} }
}
{ "execute": "query-named-block-nodes" } { "execute": "query-named-block-nodes" }
{ "execute": "device_add", { "execute": "device_add",
"arguments": { "driver": "virtio-blk", "drive": "disk", "arguments": { "driver": "virtio-blk", "drive": "disk",

View File

@ -107,16 +107,13 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"node-name": "drive0", "node-name": "drive0",
"driver": "file", "driver": "file",
"filename": "$TEST_IMG" "filename": "$TEST_IMG"
} }
}
} }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "drive0-debug", "node-name": "drive0-debug",
"file": { "file": {
@ -127,7 +124,6 @@ run_qemu <<EOF
}] }]
} }
} }
}
} }
{ "execute": "human-monitor-command", { "execute": "human-monitor-command",
"arguments": { "arguments": {
@ -145,7 +141,6 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"node-name": "drive0", "node-name": "drive0",
"driver": "$IMGFMT", "driver": "$IMGFMT",
"file": { "file": {
@ -153,11 +148,9 @@ run_qemu <<EOF
"filename": "$TEST_IMG" "filename": "$TEST_IMG"
} }
} }
}
} }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "blkverify", "driver": "blkverify",
"node-name": "drive0-verify", "node-name": "drive0-verify",
"test": "drive0", "test": "drive0",
@ -166,7 +159,6 @@ run_qemu <<EOF
"filename": "$TEST_IMG.base" "filename": "$TEST_IMG.base"
} }
} }
}
} }
{ "execute": "human-monitor-command", { "execute": "human-monitor-command",
"arguments": { "arguments": {
@ -184,16 +176,13 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"node-name": "drive0", "node-name": "drive0",
"driver": "file", "driver": "file",
"filename": "$TEST_IMG.base" "filename": "$TEST_IMG.base"
} }
}
} }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "blkverify", "driver": "blkverify",
"node-name": "drive0-verify", "node-name": "drive0-verify",
"test": { "test": {
@ -205,7 +194,6 @@ run_qemu <<EOF
}, },
"raw": "drive0" "raw": "drive0"
} }
}
} }
{ "execute": "human-monitor-command", { "execute": "human-monitor-command",
"arguments": { "arguments": {
@ -223,16 +211,13 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"node-name": "drive0", "node-name": "drive0",
"driver": "file", "driver": "file",
"filename": "$TEST_IMG" "filename": "$TEST_IMG"
} }
}
} }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "drive0-debug", "node-name": "drive0-debug",
"file": { "file": {
@ -248,7 +233,6 @@ run_qemu <<EOF
}] }]
} }
} }
}
} }
{ "execute": "human-monitor-command", { "execute": "human-monitor-command",
"arguments": { "arguments": {

View File

@ -105,7 +105,6 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"node-name": "drive2", "node-name": "drive2",
"driver": "$IMGFMT", "driver": "$IMGFMT",
"file": { "file": {
@ -113,11 +112,9 @@ run_qemu <<EOF
"filename": "$TEST_DIR/2.raw" "filename": "$TEST_DIR/2.raw"
} }
} }
}
} }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "quorum", "driver": "quorum",
"node-name": "drive0-quorum", "node-name": "drive0-quorum",
"vote-threshold": 2, "vote-threshold": 2,
@ -139,7 +136,6 @@ run_qemu <<EOF
} }
] ]
} }
}
} }
{ "execute": "human-monitor-command", { "execute": "human-monitor-command",
"arguments": { "arguments": {

View File

@ -100,11 +100,10 @@ function add_snapshot_image()
_make_test_img -b "${base_image}" "$size" _make_test_img -b "${base_image}" "$size"
mv "${TEST_IMG}" "${snapshot_file}" mv "${TEST_IMG}" "${snapshot_file}"
cmd="{ 'execute': 'blockdev-add', 'arguments': cmd="{ 'execute': 'blockdev-add', 'arguments':
{ 'options':
{ 'driver': 'qcow2', 'node-name': 'snap_${1}', ${extra_params} { 'driver': 'qcow2', 'node-name': 'snap_${1}', ${extra_params}
'file': 'file':
{ 'driver': 'file', 'filename': '${snapshot_file}', { 'driver': 'file', 'filename': '${snapshot_file}',
'node-name': 'file_${1}' } } } }" 'node-name': 'file_${1}' } } }"
_send_qemu_cmd $h "${cmd}" "return" _send_qemu_cmd $h "${cmd}" "return"
} }

View File

@ -61,7 +61,6 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"file": { "file": {
"driver": "file", "driver": "file",
@ -69,7 +68,6 @@ run_qemu <<EOF
} }
} }
} }
}
{ "execute": "quit" } { "execute": "quit" }
EOF EOF
@ -81,7 +79,6 @@ run_qemu -drive driver=$IMGFMT,id=disk,node-name=test-node,file="$TEST_IMG" <<EO
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "disk", "node-name": "disk",
"file": { "file": {
@ -90,10 +87,8 @@ run_qemu -drive driver=$IMGFMT,id=disk,node-name=test-node,file="$TEST_IMG" <<EO
} }
} }
} }
}
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "test-node", "node-name": "test-node",
"file": { "file": {
@ -102,7 +97,6 @@ run_qemu -drive driver=$IMGFMT,id=disk,node-name=test-node,file="$TEST_IMG" <<EO
} }
} }
} }
}
{ "execute": "quit" } { "execute": "quit" }
EOF EOF
@ -114,7 +108,6 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "disk", "node-name": "disk",
"file": { "file": {
@ -124,7 +117,6 @@ run_qemu <<EOF
} }
} }
} }
}
{ "execute": "quit" } { "execute": "quit" }
EOF EOF
@ -137,7 +129,6 @@ run_qemu -S <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "disk", "node-name": "disk",
"file": { "file": {
@ -146,7 +137,6 @@ run_qemu -S <<EOF
} }
} }
} }
}
{ "execute": "quit" } { "execute": "quit" }
EOF EOF
@ -154,7 +144,6 @@ run_qemu <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"driver": "$IMGFMT", "driver": "$IMGFMT",
"node-name": "disk", "node-name": "disk",
"file": { "file": {
@ -163,7 +152,6 @@ run_qemu <<EOF
} }
} }
} }
}
{ "execute": "quit" } { "execute": "quit" }
EOF EOF
@ -176,11 +164,9 @@ run_qemu -S <<EOF
{ "execute": "qmp_capabilities" } { "execute": "qmp_capabilities" }
{ "execute": "blockdev-add", { "execute": "blockdev-add",
"arguments": { "arguments": {
"options": {
"node-name": "disk" "node-name": "disk"
} }
} }
}
{ "execute": "quit" } { "execute": "quit" }
EOF EOF

View File

@ -52,16 +52,16 @@ _send_qemu_cmd $QEMU_HANDLE \
_send_qemu_cmd $QEMU_HANDLE \ _send_qemu_cmd $QEMU_HANDLE \
"{ 'execute': 'blockdev-add', "{ 'execute': 'blockdev-add',
'arguments': { 'options': { 'node-name': 'protocol', 'arguments': { 'node-name': 'protocol',
'driver': 'file', 'driver': 'file',
'filename': '$TEST_IMG' } } }" \ 'filename': '$TEST_IMG' } }" \
'return' 'return'
_send_qemu_cmd $QEMU_HANDLE \ _send_qemu_cmd $QEMU_HANDLE \
"{ 'execute': 'blockdev-add', "{ 'execute': 'blockdev-add',
'arguments': { 'options': { 'node-name': 'format', 'arguments': { 'node-name': 'format',
'driver': '$IMGFMT', 'driver': '$IMGFMT',
'file': 'protocol' } } }" \ 'file': 'protocol' } }" \
'return' 'return'
_send_qemu_cmd $QEMU_HANDLE \ _send_qemu_cmd $QEMU_HANDLE \

View File

@ -229,10 +229,10 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
def test_cycle(self): def test_cycle(self):
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
options={'node-name': 'new', node_name='new',
'driver': iotests.imgfmt, driver=iotests.imgfmt,
'file': {'filename': new_img, file={'filename': new_img,
'driver': 'file'}}) 'driver': 'file'})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
if self.device_name is not None: if self.device_name is not None:
@ -309,10 +309,10 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
return return
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
options={'node-name': 'new', node_name='new',
'driver': iotests.imgfmt, driver=iotests.imgfmt,
'file': {'filename': new_img, file={'filename': new_img,
'driver': 'file'}}) 'driver': 'file'})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp('x-blockdev-insert-medium', device='drive0', result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
@ -341,10 +341,10 @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):
def test_insert_on_filled(self): def test_insert_on_filled(self):
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
options={'node-name': 'new', node_name='new',
'driver': iotests.imgfmt, driver=iotests.imgfmt,
'file': {'filename': new_img, file={'filename': new_img,
'driver': 'file'}}) 'driver': 'file'})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp('blockdev-open-tray', device='drive0') result = self.vm.qmp('blockdev-open-tray', device='drive0')
@ -609,11 +609,11 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
options={'node-name': 'new', node_name='new',
'driver': iotests.imgfmt, driver=iotests.imgfmt,
'read-only': True, read_only=True,
'file': {'filename': new_img, file={'filename': new_img,
'driver': 'file'}}) 'driver': 'file'})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp('query-block') result = self.vm.qmp('query-block')
@ -663,10 +663,10 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
self.assert_qmp_absent(result, 'return[0]/inserted') self.assert_qmp_absent(result, 'return[0]/inserted')
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
options={'node-name': 'node0', node_name='node0',
'driver': iotests.imgfmt, driver=iotests.imgfmt,
'file': {'filename': old_img, file={'filename': old_img,
'driver': 'file'}}) 'driver': 'file'})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp('x-blockdev-insert-medium', device='drive0', result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',

View File

@ -416,10 +416,10 @@ class TestIncrementalBackup(TestIncrementalBackupBase):
('0xcd', '32M', '124k'))) ('0xcd', '32M', '124k')))
# Create a blkdebug interface to this img as 'drive1' # Create a blkdebug interface to this img as 'drive1'
result = self.vm.qmp('blockdev-add', options={ result = self.vm.qmp('blockdev-add',
'node-name': drive1['id'], node_name=drive1['id'],
'driver': drive1['fmt'], driver=drive1['fmt'],
'file': { file={
'driver': 'blkdebug', 'driver': 'blkdebug',
'image': { 'image': {
'driver': 'file', 'driver': 'file',
@ -438,7 +438,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase):
'once': True 'once': True
}], }],
} }
}) )
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
# Create bitmaps and full backups for both drives # Create bitmaps and full backups for both drives
@ -560,10 +560,10 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
''' '''
drive0 = self.drives[0] drive0 = self.drives[0]
result = self.vm.qmp('blockdev-add', options={ result = self.vm.qmp('blockdev-add',
'node-name': drive0['id'], node_name=drive0['id'],
'driver': drive0['fmt'], driver=drive0['fmt'],
'file': { file={
'driver': 'blkdebug', 'driver': 'blkdebug',
'image': { 'image': {
'driver': 'file', 'driver': 'file',
@ -582,7 +582,7 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
'once': True 'once': True
}], }],
} }
}) )
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
self.create_anchor_backup(drive0) self.create_anchor_backup(drive0)

View File

@ -57,7 +57,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'file': {'driver': 'file', 'file': {'driver': 'file',
'node-name': file_node, 'node-name': file_node,
'filename': base_img}} 'filename': base_img}}
result = self.vm.qmp('blockdev-add', conv_keys = False, options = opts) result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
self.checkBlockDriverState(node) self.checkBlockDriverState(node)
self.checkBlockDriverState(file_node) self.checkBlockDriverState(file_node)
@ -72,7 +72,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'backing': '', 'backing': '',
'file': {'driver': 'file', 'file': {'driver': 'file',
'filename': new_img}} 'filename': new_img}}
result = self.vm.qmp('blockdev-add', conv_keys = False, options = opts) result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
self.checkBlockDriverState(node) self.checkBlockDriverState(node)
@ -185,7 +185,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
opts = {'driver': 'blkdebug', opts = {'driver': 'blkdebug',
'node-name': debug, 'node-name': debug,
'image': image} 'image': image}
result = self.vm.qmp('blockdev-add', conv_keys = False, options = opts) result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
self.checkBlockDriverState(node) self.checkBlockDriverState(node)
self.checkBlockDriverState(debug) self.checkBlockDriverState(debug)
@ -210,7 +210,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'node-name': blkverify, 'node-name': blkverify,
'test': node_0, 'test': node_0,
'raw': node_1} 'raw': node_1}
result = self.vm.qmp('blockdev-add', conv_keys = False, options = opts) result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
self.checkBlockDriverState(test) self.checkBlockDriverState(test)
self.checkBlockDriverState(raw) self.checkBlockDriverState(raw)
@ -234,7 +234,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
'node-name': quorum, 'node-name': quorum,
'vote-threshold': 1, 'vote-threshold': 1,
'children': [ child_0, child_1 ]} 'children': [ child_0, child_1 ]}
result = self.vm.qmp('blockdev-add', conv_keys = False, options = opts) result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
self.checkBlockDriverState(child0) self.checkBlockDriverState(child0)
self.checkBlockDriverState(child1) self.checkBlockDriverState(child1)

View File

@ -50,13 +50,12 @@ test_blockjob()
_send_qemu_cmd $QEMU_HANDLE \ _send_qemu_cmd $QEMU_HANDLE \
"{'execute': 'blockdev-add', "{'execute': 'blockdev-add',
'arguments': { 'arguments': {
'options': {
'node-name': 'drv0', 'node-name': 'drv0',
'driver': '$IMGFMT', 'driver': '$IMGFMT',
'file': { 'file': {
'driver': 'file', 'driver': 'file',
'filename': '$TEST_IMG' 'filename': '$TEST_IMG'
}}}}" \ }}}" \
'return' 'return'
_send_qemu_cmd $QEMU_HANDLE \ _send_qemu_cmd $QEMU_HANDLE \

View File

@ -63,10 +63,10 @@ class BaseClass(iotests.QMPTestCase):
# Add the BDS via blockdev-add so it stays around after the mirror block # Add the BDS via blockdev-add so it stays around after the mirror block
# job has been completed # job has been completed
result = self.vm.qmp('blockdev-add', result = self.vm.qmp('blockdev-add',
options={'node-name': 'source', node_name='source',
'driver': iotests.imgfmt, driver=iotests.imgfmt,
'file': {'driver': 'file', file={'driver': 'file',
'filename': source_img}}) 'filename': source_img})
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
result = self.vm.qmp('x-blockdev-insert-medium', result = self.vm.qmp('x-blockdev-insert-medium',
@ -90,7 +90,7 @@ class BaseClass(iotests.QMPTestCase):
if self.target_blockdev_backing: if self.target_blockdev_backing:
options['backing'] = self.target_blockdev_backing options['backing'] = self.target_blockdev_backing
result = self.vm.qmp('blockdev-add', options=options) result = self.vm.qmp('blockdev-add', **options)
self.assert_qmp(result, 'return', {}) self.assert_qmp(result, 'return', {})
def tearDown(self): def tearDown(self):