aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2019-12-16 17:57:19 +0100
committerKevin Wolf <kwolf@redhat.com>2019-12-19 14:32:43 +0100
commit55689338403cada88be4084a67081fdf838adaf5 (patch)
treeafaa24c3b89b509f51db4d623e7f48ff9819e8a6
parent08b171380c1ac6875f585691c9ef7fa837ad1ef1 (diff)
downloadqemu-55689338403cada88be4084a67081fdf838adaf5.zip
qemu-55689338403cada88be4084a67081fdf838adaf5.tar.gz
qemu-55689338403cada88be4084a67081fdf838adaf5.tar.bz2
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>
-rwxr-xr-xtests/qemu-iotests/213113
1 files changed, 52 insertions, 61 deletions
diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213
index 5604f3c..3fc8dc6 100755
--- a/tests/qemu-iotests/213
+++ b/tests/qemu-iotests/213
@@ -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()