iotests: 213: 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 <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2019-12-16 17:57:19 +01:00
parent 08b171380c
commit 5568933840
1 changed files with 52 additions and 61 deletions

View File

@ -26,15 +26,6 @@ from iotests import imgfmt
iotests.verify_image_format(supported_fmts=['vhdx'])
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.vhdx') as disk_path, \
iotests.VM() as vm:
@ -47,14 +38,14 @@ with iotests.FilePath('t.vhdx') as disk_path, \
size = 128 * 1024 * 1024
vm.launch()
blockdev_create(vm, { 'driver': 'file',
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,
vm.blockdev_create({ 'driver': imgfmt,
'file': 'imgfile',
'size': size })
vm.shutdown()
@ -71,10 +62,10 @@ with iotests.FilePath('t.vhdx') as disk_path, \
size = 64 * 1024 * 1024
vm.launch()
blockdev_create(vm, { 'driver': 'file',
vm.blockdev_create({ 'driver': 'file',
'filename': disk_path,
'size': 0 })
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': {
'driver': 'file',
'filename': disk_path,
@ -98,10 +89,10 @@ with iotests.FilePath('t.vhdx') as disk_path, \
size = 32 * 1024 * 1024
vm.launch()
blockdev_create(vm, { 'driver': 'file',
vm.blockdev_create({ 'driver': 'file',
'filename': disk_path,
'size': 0 })
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': {
'driver': 'file',
'filename': disk_path,
@ -122,7 +113,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
iotests.log("")
vm.launch()
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': "this doesn't exist",
'size': size })
vm.shutdown()
@ -135,7 +126,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
vm.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path))
vm.launch()
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': 'node0',
'size': 0 })
vm.shutdown()
@ -149,7 +140,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
iotests.log("")
vm.launch()
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': 'node0',
'size': 70368744177664 })
vm.shutdown()
@ -176,7 +167,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
vm.launch()
for size in [ 18446744073709551104, 9223372036854775808,
9223372036854775296, 70368744177665 ]:
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': 'node0',
'size': size })
vm.shutdown()
@ -189,7 +180,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
vm.launch()
for bsize in [ 1234567, 128, 3145728, 536870912, 0 ]:
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': 'node0',
'size': 67108864,
'block-size': bsize })
@ -203,7 +194,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
vm.launch()
for lsize in [ 1234567, 128, 4294967296, 0 ]:
blockdev_create(vm, { 'driver': imgfmt,
vm.blockdev_create({ 'driver': imgfmt,
'file': 'node0',
'size': 67108864,
'log-size': lsize })