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_image_format(supported_fmts=['vhdx'])
|
||||||
iotests.verify_protocol(supported=['file'])
|
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, \
|
with iotests.FilePath('t.vhdx') as disk_path, \
|
||||||
iotests.VM() as vm:
|
iotests.VM() as vm:
|
||||||
|
|
||||||
@ -47,14 +38,14 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
size = 128 * 1024 * 1024
|
size = 128 * 1024 * 1024
|
||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
blockdev_create(vm, { 'driver': 'file',
|
vm.blockdev_create({ 'driver': 'file',
|
||||||
'filename': disk_path,
|
'filename': disk_path,
|
||||||
'size': 0 })
|
'size': 0 })
|
||||||
|
|
||||||
vm.qmp_log('blockdev-add', driver='file', filename=disk_path,
|
vm.qmp_log('blockdev-add', driver='file', filename=disk_path,
|
||||||
node_name='imgfile', filters=[iotests.filter_qmp_testfiles])
|
node_name='imgfile', filters=[iotests.filter_qmp_testfiles])
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'imgfile',
|
'file': 'imgfile',
|
||||||
'size': size })
|
'size': size })
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
@ -71,10 +62,10 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
size = 64 * 1024 * 1024
|
size = 64 * 1024 * 1024
|
||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
blockdev_create(vm, { 'driver': 'file',
|
vm.blockdev_create({ 'driver': 'file',
|
||||||
'filename': disk_path,
|
'filename': disk_path,
|
||||||
'size': 0 })
|
'size': 0 })
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': {
|
'file': {
|
||||||
'driver': 'file',
|
'driver': 'file',
|
||||||
'filename': disk_path,
|
'filename': disk_path,
|
||||||
@ -98,10 +89,10 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
size = 32 * 1024 * 1024
|
size = 32 * 1024 * 1024
|
||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
blockdev_create(vm, { 'driver': 'file',
|
vm.blockdev_create({ 'driver': 'file',
|
||||||
'filename': disk_path,
|
'filename': disk_path,
|
||||||
'size': 0 })
|
'size': 0 })
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': {
|
'file': {
|
||||||
'driver': 'file',
|
'driver': 'file',
|
||||||
'filename': disk_path,
|
'filename': disk_path,
|
||||||
@ -122,7 +113,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
iotests.log("")
|
iotests.log("")
|
||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': "this doesn't exist",
|
'file': "this doesn't exist",
|
||||||
'size': size })
|
'size': size })
|
||||||
vm.shutdown()
|
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.add_blockdev('driver=file,filename=%s,node-name=node0' % (disk_path))
|
||||||
vm.launch()
|
vm.launch()
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'node0',
|
'file': 'node0',
|
||||||
'size': 0 })
|
'size': 0 })
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
@ -149,7 +140,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
iotests.log("")
|
iotests.log("")
|
||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'node0',
|
'file': 'node0',
|
||||||
'size': 70368744177664 })
|
'size': 70368744177664 })
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
@ -176,7 +167,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
vm.launch()
|
vm.launch()
|
||||||
for size in [ 18446744073709551104, 9223372036854775808,
|
for size in [ 18446744073709551104, 9223372036854775808,
|
||||||
9223372036854775296, 70368744177665 ]:
|
9223372036854775296, 70368744177665 ]:
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'node0',
|
'file': 'node0',
|
||||||
'size': size })
|
'size': size })
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
@ -189,7 +180,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
for bsize in [ 1234567, 128, 3145728, 536870912, 0 ]:
|
for bsize in [ 1234567, 128, 3145728, 536870912, 0 ]:
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'node0',
|
'file': 'node0',
|
||||||
'size': 67108864,
|
'size': 67108864,
|
||||||
'block-size': bsize })
|
'block-size': bsize })
|
||||||
@ -203,7 +194,7 @@ with iotests.FilePath('t.vhdx') as disk_path, \
|
|||||||
|
|
||||||
vm.launch()
|
vm.launch()
|
||||||
for lsize in [ 1234567, 128, 4294967296, 0 ]:
|
for lsize in [ 1234567, 128, 4294967296, 0 ]:
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'node0',
|
'file': 'node0',
|
||||||
'size': 67108864,
|
'size': 67108864,
|
||||||
'log-size': lsize })
|
'log-size': lsize })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user