iotests: 266: 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
59f61afa7e
commit
de1ff674a0
@ -22,15 +22,6 @@ import iotests
|
|||||||
from iotests import imgfmt
|
from iotests import imgfmt
|
||||||
|
|
||||||
|
|
||||||
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')
|
|
||||||
|
|
||||||
|
|
||||||
# Successful image creation (defaults)
|
# Successful image creation (defaults)
|
||||||
def implicit_defaults(vm, file_path):
|
def implicit_defaults(vm, file_path):
|
||||||
iotests.log("=== Successful image creation (defaults) ===")
|
iotests.log("=== Successful image creation (defaults) ===")
|
||||||
@ -40,9 +31,9 @@ def implicit_defaults(vm, file_path):
|
|||||||
# (Close to 64 MB)
|
# (Close to 64 MB)
|
||||||
size = 8 * 964 * 17 * 512
|
size = 8 * 964 * 17 * 512
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': size })
|
'size': size })
|
||||||
|
|
||||||
|
|
||||||
# Successful image creation (explicit defaults)
|
# Successful image creation (explicit defaults)
|
||||||
@ -54,11 +45,11 @@ def explicit_defaults(vm, file_path):
|
|||||||
# (Close to 128 MB)
|
# (Close to 128 MB)
|
||||||
size = 16 * 964 * 17 * 512
|
size = 16 * 964 * 17 * 512
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': size,
|
'size': size,
|
||||||
'subformat': 'dynamic',
|
'subformat': 'dynamic',
|
||||||
'force-size': False })
|
'force-size': False })
|
||||||
|
|
||||||
|
|
||||||
# Successful image creation (non-default options)
|
# Successful image creation (non-default options)
|
||||||
@ -69,11 +60,11 @@ def non_defaults(vm, file_path):
|
|||||||
# Not representable in CHS (fine with force-size=True)
|
# Not representable in CHS (fine with force-size=True)
|
||||||
size = 1048576
|
size = 1048576
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': size,
|
'size': size,
|
||||||
'subformat': 'fixed',
|
'subformat': 'fixed',
|
||||||
'force-size': True })
|
'force-size': True })
|
||||||
|
|
||||||
|
|
||||||
# Size not representable in CHS with force-size=False
|
# Size not representable in CHS with force-size=False
|
||||||
@ -84,10 +75,10 @@ def non_chs_size_without_force(vm, file_path):
|
|||||||
# Not representable in CHS (will not work with force-size=False)
|
# Not representable in CHS (will not work with force-size=False)
|
||||||
size = 1048576
|
size = 1048576
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': size,
|
'size': size,
|
||||||
'force-size': False })
|
'force-size': False })
|
||||||
|
|
||||||
|
|
||||||
# Zero size
|
# Zero size
|
||||||
@ -95,9 +86,9 @@ def zero_size(vm, file_path):
|
|||||||
iotests.log("=== Zero size===")
|
iotests.log("=== Zero size===")
|
||||||
iotests.log("")
|
iotests.log("")
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': 0 })
|
'size': 0 })
|
||||||
|
|
||||||
|
|
||||||
# Maximum CHS size
|
# Maximum CHS size
|
||||||
@ -105,9 +96,9 @@ def maximum_chs_size(vm, file_path):
|
|||||||
iotests.log("=== Maximum CHS size===")
|
iotests.log("=== Maximum CHS size===")
|
||||||
iotests.log("")
|
iotests.log("")
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': 16 * 65535 * 255 * 512 })
|
'size': 16 * 65535 * 255 * 512 })
|
||||||
|
|
||||||
|
|
||||||
# Actual maximum size
|
# Actual maximum size
|
||||||
@ -115,10 +106,10 @@ def maximum_size(vm, file_path):
|
|||||||
iotests.log("=== Actual maximum size===")
|
iotests.log("=== Actual maximum size===")
|
||||||
iotests.log("")
|
iotests.log("")
|
||||||
|
|
||||||
blockdev_create(vm, { 'driver': imgfmt,
|
vm.blockdev_create({ 'driver': imgfmt,
|
||||||
'file': 'protocol-node',
|
'file': 'protocol-node',
|
||||||
'size': 0xff000000 * 512,
|
'size': 0xff000000 * 512,
|
||||||
'force-size': True })
|
'force-size': True })
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -132,9 +123,9 @@ def main():
|
|||||||
vm.launch()
|
vm.launch()
|
||||||
|
|
||||||
iotests.log('--- Creating empty file ---')
|
iotests.log('--- Creating empty file ---')
|
||||||
blockdev_create(vm, { 'driver': 'file',
|
vm.blockdev_create({ 'driver': 'file',
|
||||||
'filename': file_path,
|
'filename': file_path,
|
||||||
'size': 0 })
|
'size': 0 })
|
||||||
|
|
||||||
vm.qmp_log('blockdev-add', driver='file', filename=file_path,
|
vm.qmp_log('blockdev-add', driver='file', filename=file_path,
|
||||||
node_name='protocol-node',
|
node_name='protocol-node',
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -13,6 +14,7 @@
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
image: TEST_IMG
|
image: TEST_IMG
|
||||||
file format: IMGFMT
|
file format: IMGFMT
|
||||||
virtual size: 64 MiB (67125248 bytes)
|
virtual size: 64 MiB (67125248 bytes)
|
||||||
@ -23,6 +25,7 @@ cluster_size: 2097152
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -33,6 +36,7 @@ cluster_size: 2097152
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
image: TEST_IMG
|
image: TEST_IMG
|
||||||
file format: IMGFMT
|
file format: IMGFMT
|
||||||
virtual size: 128 MiB (134250496 bytes)
|
virtual size: 128 MiB (134250496 bytes)
|
||||||
@ -43,6 +47,7 @@ cluster_size: 2097152
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -53,6 +58,7 @@ cluster_size: 2097152
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
image: TEST_IMG
|
image: TEST_IMG
|
||||||
file format: IMGFMT
|
file format: IMGFMT
|
||||||
virtual size: 1 MiB (1048576 bytes)
|
virtual size: 1 MiB (1048576 bytes)
|
||||||
@ -62,6 +68,7 @@ virtual size: 1 MiB (1048576 bytes)
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -73,6 +80,7 @@ Job failed: The requested image size cannot be represented in CHS geometry
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
qemu-img: Could not open 'TEST_IMG': File too small for a VHD header
|
qemu-img: Could not open 'TEST_IMG': File too small for a VHD header
|
||||||
|
|
||||||
--- Creating empty file ---
|
--- Creating empty file ---
|
||||||
@ -80,6 +88,7 @@ qemu-img: Could not open 'TEST_IMG': File too small for a VHD header
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -90,6 +99,7 @@ qemu-img: Could not open 'TEST_IMG': File too small for a VHD header
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
image: TEST_IMG
|
image: TEST_IMG
|
||||||
file format: IMGFMT
|
file format: IMGFMT
|
||||||
virtual size: 0 B (0 bytes)
|
virtual size: 0 B (0 bytes)
|
||||||
@ -100,6 +110,7 @@ cluster_size: 2097152
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -110,6 +121,7 @@ cluster_size: 2097152
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
image: TEST_IMG
|
image: TEST_IMG
|
||||||
file format: IMGFMT
|
file format: IMGFMT
|
||||||
virtual size: 127 GiB (136899993600 bytes)
|
virtual size: 127 GiB (136899993600 bytes)
|
||||||
@ -120,6 +132,7 @@ cluster_size: 2097152
|
|||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
@ -130,6 +143,7 @@ cluster_size: 2097152
|
|||||||
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
||||||
|
|
||||||
image: TEST_IMG
|
image: TEST_IMG
|
||||||
file format: IMGFMT
|
file format: IMGFMT
|
||||||
virtual size: 1.99 TiB (2190433320960 bytes)
|
virtual size: 1.99 TiB (2190433320960 bytes)
|
||||||
|
Loading…
Reference in New Issue
Block a user