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:
parent
08b171380c
commit
5568933840
@ -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,16 +38,16 @@ with iotests.FilePath('t.vhdx') 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,19 +62,19 @@ with iotests.FilePath('t.vhdx') 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,
|
||||
'log-size': 1048576,
|
||||
'block-size': 8388608,
|
||||
'subformat': 'dynamic',
|
||||
'block-state-zero': True })
|
||||
vm.blockdev_create({ 'driver': 'file',
|
||||
'filename': disk_path,
|
||||
'size': 0 })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': {
|
||||
'driver': 'file',
|
||||
'filename': disk_path,
|
||||
},
|
||||
'size': size,
|
||||
'log-size': 1048576,
|
||||
'block-size': 8388608,
|
||||
'subformat': 'dynamic',
|
||||
'block-state-zero': True })
|
||||
vm.shutdown()
|
||||
|
||||
iotests.img_info_log(disk_path)
|
||||
@ -98,19 +89,19 @@ with iotests.FilePath('t.vhdx') 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,
|
||||
'log-size': 8388608,
|
||||
'block-size': 268435456,
|
||||
'subformat': 'fixed',
|
||||
'block-state-zero': False })
|
||||
vm.blockdev_create({ 'driver': 'file',
|
||||
'filename': disk_path,
|
||||
'size': 0 })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': {
|
||||
'driver': 'file',
|
||||
'filename': disk_path,
|
||||
},
|
||||
'size': size,
|
||||
'log-size': 8388608,
|
||||
'block-size': 268435456,
|
||||
'subformat': 'fixed',
|
||||
'block-state-zero': False })
|
||||
vm.shutdown()
|
||||
|
||||
iotests.img_info_log(disk_path)
|
||||
@ -122,9 +113,9 @@ with iotests.FilePath('t.vhdx') 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()
|
||||
|
||||
#
|
||||
@ -135,9 +126,9 @@ 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,
|
||||
'file': 'node0',
|
||||
'size': 0 })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 0 })
|
||||
vm.shutdown()
|
||||
|
||||
iotests.img_info_log(disk_path)
|
||||
@ -149,9 +140,9 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
||||
iotests.log("")
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 70368744177664 })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 70368744177664 })
|
||||
vm.shutdown()
|
||||
|
||||
iotests.img_info_log(disk_path)
|
||||
@ -176,9 +167,9 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
||||
vm.launch()
|
||||
for size in [ 18446744073709551104, 9223372036854775808,
|
||||
9223372036854775296, 70368744177665 ]:
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': size })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': size })
|
||||
vm.shutdown()
|
||||
|
||||
#
|
||||
@ -189,10 +180,10 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
||||
|
||||
vm.launch()
|
||||
for bsize in [ 1234567, 128, 3145728, 536870912, 0 ]:
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'block-size': bsize })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'block-size': bsize })
|
||||
vm.shutdown()
|
||||
|
||||
#
|
||||
@ -203,8 +194,8 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
||||
|
||||
vm.launch()
|
||||
for lsize in [ 1234567, 128, 4294967296, 0 ]:
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'log-size': lsize })
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'log-size': lsize })
|
||||
vm.shutdown()
|
||||
|
Loading…
Reference in New Issue
Block a user