mirror of https://github.com/xemu-project/xemu.git
iotests: 206: 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
a0de1e5330
commit
f6da17366a
|
@ -25,16 +25,6 @@ from iotests import imgfmt
|
|||
|
||||
iotests.verify_image_format(supported_fmts=['qcow2'])
|
||||
|
||||
def blockdev_create(vm, options):
|
||||
result = vm.qmp_log('blockdev-create',
|
||||
filters=[iotests.filter_qmp_testfiles],
|
||||
job_id='job0', options=options)
|
||||
|
||||
if 'return' in result:
|
||||
assert result['return'] == {}
|
||||
vm.run_job('job0')
|
||||
iotests.log("")
|
||||
|
||||
with iotests.FilePath('t.qcow2') as disk_path, \
|
||||
iotests.FilePath('t.qcow2.base') as backing_path, \
|
||||
iotests.VM() as vm:
|
||||
|
@ -50,7 +40,7 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
size = 128 * 1024 * 1024
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': 'file',
|
||||
vm.blockdev_create({ 'driver': 'file',
|
||||
'filename': disk_path,
|
||||
'size': 0 })
|
||||
|
||||
|
@ -59,7 +49,7 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
driver='file', filename=disk_path,
|
||||
node_name='imgfile')
|
||||
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'imgfile',
|
||||
'size': size })
|
||||
vm.shutdown()
|
||||
|
@ -76,13 +66,13 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
size = 64 * 1024 * 1024
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': 'file',
|
||||
vm.blockdev_create({ 'driver': 'file',
|
||||
'filename': disk_path,
|
||||
'size': 0,
|
||||
'preallocation': 'off',
|
||||
'nocow': False })
|
||||
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': {
|
||||
'driver': 'file',
|
||||
'filename': disk_path,
|
||||
|
@ -107,13 +97,13 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
size = 32 * 1024 * 1024
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': 'file',
|
||||
vm.blockdev_create({ 'driver': 'file',
|
||||
'filename': disk_path,
|
||||
'size': 0,
|
||||
'preallocation': 'falloc',
|
||||
'nocow': True })
|
||||
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': {
|
||||
'driver': 'file',
|
||||
'filename': disk_path,
|
||||
|
@ -135,11 +125,11 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
iotests.log("")
|
||||
|
||||
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,
|
||||
|
@ -160,7 +150,7 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
iotests.log("")
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': {
|
||||
'driver': 'file',
|
||||
'filename': disk_path,
|
||||
|
@ -187,7 +177,7 @@ with iotests.FilePath('t.qcow2') 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()
|
||||
|
@ -211,7 +201,7 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
vm.launch()
|
||||
for size in [ 1234, 18446744073709551104, 9223372036854775808,
|
||||
9223372036854775296 ]:
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': size })
|
||||
vm.shutdown()
|
||||
|
@ -222,16 +212,16 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
iotests.log("=== Invalid version ===")
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'version': 'v1' })
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'version': 'v2',
|
||||
'lazy-refcounts': True })
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'version': 'v2',
|
||||
|
@ -244,12 +234,12 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
iotests.log("=== Invalid backing file options ===")
|
||||
|
||||
vm.launch()
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'backing-file': '/dev/null',
|
||||
'preallocation': 'full' })
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'backing-fmt': imgfmt })
|
||||
|
@ -262,11 +252,11 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
|
||||
vm.launch()
|
||||
for csize in [ 1234, 128, 4194304, 0 ]:
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'cluster-size': csize })
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 281474976710656,
|
||||
'cluster-size': 512 })
|
||||
|
@ -279,7 +269,7 @@ with iotests.FilePath('t.qcow2') as disk_path, \
|
|||
|
||||
vm.launch()
|
||||
for refcount_bits in [ 128, 0, 7 ]:
|
||||
blockdev_create(vm, { 'driver': imgfmt,
|
||||
vm.blockdev_create({ 'driver': imgfmt,
|
||||
'file': 'node0',
|
||||
'size': 67108864,
|
||||
'refcount-bits': refcount_bits })
|
||||
|
|
Loading…
Reference in New Issue