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
commitde1ff674a0f56e97d944ba66a8bbc89e2769d8c1 (patch)
tree7c32188ee138087d079985207d224a8128f91a79
parent59f61afa7e1800ee513a7ba8ef03bec0a370438c (diff)
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>
-rwxr-xr-xtests/qemu-iotests/26669
-rw-r--r--tests/qemu-iotests/266.out14
2 files changed, 44 insertions, 39 deletions
diff --git a/tests/qemu-iotests/266 b/tests/qemu-iotests/266
index 5b35cd67e4..c353cf88ee 100755
--- a/tests/qemu-iotests/266
+++ b/tests/qemu-iotests/266
@@ -22,15 +22,6 @@ import iotests
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)
def implicit_defaults(vm, file_path):
iotests.log("=== Successful image creation (defaults) ===")
@@ -40,9 +31,9 @@ def implicit_defaults(vm, file_path):
# (Close to 64 MB)
size = 8 * 964 * 17 * 512
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': size })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': size })
# Successful image creation (explicit defaults)
@@ -54,11 +45,11 @@ def explicit_defaults(vm, file_path):
# (Close to 128 MB)
size = 16 * 964 * 17 * 512
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': size,
- 'subformat': 'dynamic',
- 'force-size': False })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': size,
+ 'subformat': 'dynamic',
+ 'force-size': False })
# 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)
size = 1048576
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': size,
- 'subformat': 'fixed',
- 'force-size': True })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': size,
+ 'subformat': 'fixed',
+ 'force-size': True })
# 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)
size = 1048576
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': size,
- 'force-size': False })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': size,
+ 'force-size': False })
# Zero size
@@ -95,9 +86,9 @@ def zero_size(vm, file_path):
iotests.log("=== Zero size===")
iotests.log("")
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': 0 })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': 0 })
# Maximum CHS size
@@ -105,9 +96,9 @@ def maximum_chs_size(vm, file_path):
iotests.log("=== Maximum CHS size===")
iotests.log("")
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': 16 * 65535 * 255 * 512 })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': 16 * 65535 * 255 * 512 })
# Actual maximum size
@@ -115,10 +106,10 @@ def maximum_size(vm, file_path):
iotests.log("=== Actual maximum size===")
iotests.log("")
- blockdev_create(vm, { 'driver': imgfmt,
- 'file': 'protocol-node',
- 'size': 0xff000000 * 512,
- 'force-size': True })
+ vm.blockdev_create({ 'driver': imgfmt,
+ 'file': 'protocol-node',
+ 'size': 0xff000000 * 512,
+ 'force-size': True })
def main():
@@ -132,9 +123,9 @@ def main():
vm.launch()
iotests.log('--- Creating empty file ---')
- blockdev_create(vm, { 'driver': 'file',
- 'filename': file_path,
- 'size': 0 })
+ vm.blockdev_create({ 'driver': 'file',
+ 'filename': file_path,
+ 'size': 0 })
vm.qmp_log('blockdev-add', driver='file', filename=file_path,
node_name='protocol-node',
diff --git a/tests/qemu-iotests/266.out b/tests/qemu-iotests/266.out
index b11953e81f..5a7d7d01aa 100644
--- a/tests/qemu-iotests/266.out
+++ b/tests/qemu-iotests/266.out
@@ -3,6 +3,7 @@
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"return": {}}
@@ -13,6 +14,7 @@
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
image: TEST_IMG
file format: IMGFMT
virtual size: 64 MiB (67125248 bytes)
@@ -23,6 +25,7 @@ cluster_size: 2097152
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"return": {}}
@@ -33,6 +36,7 @@ cluster_size: 2097152
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
image: TEST_IMG
file format: IMGFMT
virtual size: 128 MiB (134250496 bytes)
@@ -43,6 +47,7 @@ cluster_size: 2097152
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"return": {}}
@@ -53,6 +58,7 @@ cluster_size: 2097152
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
image: TEST_IMG
file format: IMGFMT
virtual size: 1 MiB (1048576 bytes)
@@ -62,6 +68,7 @@ virtual size: 1 MiB (1048576 bytes)
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"return": {}}
@@ -73,6 +80,7 @@ Job failed: The requested image size cannot be represented in CHS geometry
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
qemu-img: Could not open 'TEST_IMG': File too small for a VHD header
--- Creating empty file ---
@@ -80,6 +88,7 @@ qemu-img: Could not open 'TEST_IMG': File too small for a VHD header
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"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"}}
{"return": {}}
+
image: TEST_IMG
file format: IMGFMT
virtual size: 0 B (0 bytes)
@@ -100,6 +110,7 @@ cluster_size: 2097152
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"return": {}}
@@ -110,6 +121,7 @@ cluster_size: 2097152
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
image: TEST_IMG
file format: IMGFMT
virtual size: 127 GiB (136899993600 bytes)
@@ -120,6 +132,7 @@ cluster_size: 2097152
{"return": {}}
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}}
{"return": {}}
@@ -130,6 +143,7 @@ cluster_size: 2097152
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
{"return": {}}
+
image: TEST_IMG
file format: IMGFMT
virtual size: 1.99 TiB (2190433320960 bytes)