qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: [PATCH 06/10] iotests: 213: Convert to VM.blockdev_create()
Date: Mon, 16 Dec 2019 18:08:53 +0100	[thread overview]
Message-ID: <20191216170857.11880-7-kwolf@redhat.com> (raw)
In-Reply-To: <20191216170857.11880-1-kwolf@redhat.com>

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>
---
 tests/qemu-iotests/213 | 113 +++++++++++++++++++----------------------
 1 file changed, 52 insertions(+), 61 deletions(-)

diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213
index 5604f3cebb..3fc8dc6eaa 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()
-- 
2.20.1



  parent reply	other threads:[~2019-12-16 17:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 17:08 [PATCH 00/10] iotests: Remove duplicated blockdev_create() Kevin Wolf
2019-12-16 17:08 ` [PATCH 01/10] iotests: Create VM.blockdev_create() Kevin Wolf
2019-12-16 17:08 ` [PATCH 02/10] iotests: 255: Drop blockdev_create() Kevin Wolf
2019-12-16 17:08 ` [PATCH 03/10] iotests: 206: Convert to VM.blockdev_create() Kevin Wolf
2019-12-16 17:08 ` [PATCH 04/10] iotests: 210: " Kevin Wolf
2019-12-16 17:08 ` [PATCH 05/10] iotests: 212: " Kevin Wolf
2019-12-16 17:08 ` Kevin Wolf [this message]
2019-12-16 17:08 ` [PATCH 07/10] iotests: 237: " Kevin Wolf
2019-12-16 17:08 ` [PATCH 08/10] iotests: 266: " Kevin Wolf
2019-12-16 17:08 ` [PATCH 09/10] iotests: 207: Remove duplication with VM.blockdev_create() Kevin Wolf
2019-12-16 17:08 ` [PATCH 10/10] iotests: 211: " Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191216170857.11880-7-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).