From 08b171380c1ac6875f585691c9ef7fa837ad1ef1 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 16 Dec 2019 17:57:19 +0100 Subject: [PATCH] iotests: 212: Convert to VM.blockdev_create() Instead of having a separate blockdev_create() function, make use of the VM.blockdev_create() offered by iotests.py. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/212 | 101 ++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 55 deletions(-) diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212 index 42b74f208b..8f3ccc7b15 100755 --- a/tests/qemu-iotests/212 +++ b/tests/qemu-iotests/212 @@ -26,15 +26,6 @@ from iotests import imgfmt iotests.verify_image_format(supported_fmts=['parallels']) iotests.verify_protocol(supported=['file']) -def blockdev_create(vm, options): - result = vm.qmp_log('blockdev-create', job_id='job0', options=options, - filters=[iotests.filter_qmp_testfiles]) - - if 'return' in result: - assert result['return'] == {} - vm.run_job('job0') - iotests.log("") - with iotests.FilePath('t.parallels') as disk_path, \ iotests.VM() as vm: @@ -47,16 +38,16 @@ with iotests.FilePath('t.parallels') as disk_path, \ size = 128 * 1024 * 1024 vm.launch() - blockdev_create(vm, { 'driver': 'file', - 'filename': disk_path, - 'size': 0 }) + vm.blockdev_create({ 'driver': 'file', + 'filename': disk_path, + 'size': 0 }) vm.qmp_log('blockdev-add', driver='file', filename=disk_path, node_name='imgfile', filters=[iotests.filter_qmp_testfiles]) - blockdev_create(vm, { 'driver': imgfmt, - 'file': 'imgfile', - 'size': size }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': 'imgfile', + 'size': size }) vm.shutdown() iotests.img_info_log(disk_path) @@ -71,16 +62,16 @@ with iotests.FilePath('t.parallels') as disk_path, \ size = 64 * 1024 * 1024 vm.launch() - blockdev_create(vm, { 'driver': 'file', - 'filename': disk_path, - 'size': 0 }) - blockdev_create(vm, { 'driver': imgfmt, - 'file': { - 'driver': 'file', - 'filename': disk_path, - }, - 'size': size, - 'cluster-size': 1048576 }) + vm.blockdev_create({ 'driver': 'file', + 'filename': disk_path, + 'size': 0 }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': { + 'driver': 'file', + 'filename': disk_path, + }, + 'size': size, + 'cluster-size': 1048576 }) vm.shutdown() iotests.img_info_log(disk_path) @@ -95,16 +86,16 @@ with iotests.FilePath('t.parallels') as disk_path, \ size = 32 * 1024 * 1024 vm.launch() - blockdev_create(vm, { 'driver': 'file', - 'filename': disk_path, - 'size': 0 }) - blockdev_create(vm, { 'driver': imgfmt, - 'file': { - 'driver': 'file', - 'filename': disk_path, - }, - 'size': size, - 'cluster-size': 65536 }) + vm.blockdev_create({ 'driver': 'file', + 'filename': disk_path, + 'size': 0 }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': { + 'driver': 'file', + 'filename': disk_path, + }, + 'size': size, + 'cluster-size': 65536 }) vm.shutdown() iotests.img_info_log(disk_path) @@ -116,9 +107,9 @@ with iotests.FilePath('t.parallels') as disk_path, \ iotests.log("") vm.launch() - blockdev_create(vm, { 'driver': imgfmt, - 'file': "this doesn't exist", - 'size': size }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': "this doesn't exist", + 'size': size }) vm.shutdown() # @@ -129,9 +120,9 @@ with iotests.FilePath('t.parallels') as disk_path, \ vm.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path)) vm.launch() - blockdev_create(vm, { 'driver': imgfmt, - 'file': 'node0', - 'size': 0 }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': 'node0', + 'size': 0 }) vm.shutdown() iotests.img_info_log(disk_path) @@ -143,9 +134,9 @@ with iotests.FilePath('t.parallels') as disk_path, \ iotests.log("") vm.launch() - blockdev_create(vm, { 'driver': imgfmt, - 'file': 'node0', - 'size': 4503599627369984}) + vm.blockdev_create({ 'driver': imgfmt, + 'file': 'node0', + 'size': 4503599627369984}) vm.shutdown() iotests.img_info_log(disk_path) @@ -171,9 +162,9 @@ with iotests.FilePath('t.parallels') as disk_path, \ vm.launch() for size in [ 1234, 18446744073709551104, 9223372036854775808, 9223372036854775296, 4503599627370497 ]: - blockdev_create(vm, { 'driver': imgfmt, - 'file': 'node0', - 'size': size }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': 'node0', + 'size': size }) vm.shutdown() # @@ -185,12 +176,12 @@ with iotests.FilePath('t.parallels') as disk_path, \ vm.launch() for csize in [ 1234, 128, 4294967296, 9223372036854775808, 18446744073709551104, 0 ]: - blockdev_create(vm, { 'driver': imgfmt, - 'file': 'node0', - 'size': 67108864, - 'cluster-size': csize }) - blockdev_create(vm, { 'driver': imgfmt, - 'file': 'node0', - 'size': 281474976710656, - 'cluster-size': 512 }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': 'node0', + 'size': 67108864, + 'cluster-size': csize }) + vm.blockdev_create({ 'driver': imgfmt, + 'file': 'node0', + 'size': 281474976710656, + 'cluster-size': 512 }) vm.shutdown() -- 2.11.0