qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] iotests: Test migration with filter nodes
@ 2019-08-01 15:17 Kevin Wolf
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py Kevin Wolf
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Kevin Wolf @ 2019-08-01 15:17 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

This is the testcase for the copy-on-read fix I merged in a hurry for
4.1.0-rc3.

Kevin Wolf (3):
  iotests: Move migration helpers to iotests.py
  iotests: Enable -d for Python non-unittest tests
  iotests: Test migration with all kinds of filter nodes

 tests/qemu-iotests/194        |  1 +
 tests/qemu-iotests/202        |  1 +
 tests/qemu-iotests/203        |  2 +
 tests/qemu-iotests/206        |  1 +
 tests/qemu-iotests/207        |  1 +
 tests/qemu-iotests/208        |  1 +
 tests/qemu-iotests/210        |  1 +
 tests/qemu-iotests/211        |  1 +
 tests/qemu-iotests/212        |  1 +
 tests/qemu-iotests/213        |  1 +
 tests/qemu-iotests/216        |  2 +
 tests/qemu-iotests/218        |  1 +
 tests/qemu-iotests/219        |  1 +
 tests/qemu-iotests/222        |  1 +
 tests/qemu-iotests/224        |  2 +
 tests/qemu-iotests/228        |  2 +
 tests/qemu-iotests/234        | 30 ++++---------
 tests/qemu-iotests/236        |  1 +
 tests/qemu-iotests/237        |  1 +
 tests/qemu-iotests/246        |  1 +
 tests/qemu-iotests/255        |  1 +
 tests/qemu-iotests/256        |  1 +
 tests/qemu-iotests/262        | 84 +++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/262.out    | 17 +++++++
 tests/qemu-iotests/group      |  1 +
 tests/qemu-iotests/iotests.py | 39 ++++++++++++----
 26 files changed, 166 insertions(+), 30 deletions(-)
 create mode 100755 tests/qemu-iotests/262
 create mode 100644 tests/qemu-iotests/262.out

-- 
2.20.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py
  2019-08-01 15:17 [Qemu-devel] [PATCH 0/3] iotests: Test migration with filter nodes Kevin Wolf
@ 2019-08-01 15:17 ` Kevin Wolf
  2019-08-01 17:44   ` Max Reitz
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests Kevin Wolf
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes Kevin Wolf
  2 siblings, 1 reply; 11+ messages in thread
From: Kevin Wolf @ 2019-08-01 15:17 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

234 implements functions that are useful for doing migration between two
VMs. Move them to iotests.py so that other test cases can use them, too.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/234        | 30 +++++++-----------------------
 tests/qemu-iotests/iotests.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/tests/qemu-iotests/234 b/tests/qemu-iotests/234
index c4c26bc21e..34c818c485 100755
--- a/tests/qemu-iotests/234
+++ b/tests/qemu-iotests/234
@@ -26,22 +26,6 @@ import os
 iotests.verify_image_format(supported_fmts=['qcow2'])
 iotests.verify_platform(['linux'])
 
-def enable_migration_events(vm, name):
-    iotests.log('Enabling migration QMP events on %s...' % name)
-    iotests.log(vm.qmp('migrate-set-capabilities', capabilities=[
-        {
-            'capability': 'events',
-            'state': True
-        }
-    ]))
-
-def wait_migration(vm):
-    while True:
-        event = vm.event_wait('MIGRATION')
-        iotests.log(event, filters=[iotests.filter_qmp_event])
-        if event['data']['status'] == 'completed':
-            break
-
 with iotests.FilePath('img') as img_path, \
      iotests.FilePath('backing') as backing_path, \
      iotests.FilePath('mig_fifo_a') as fifo_a, \
@@ -62,7 +46,7 @@ with iotests.FilePath('img') as img_path, \
          .add_blockdev('%s,file=drive0-backing-file,node-name=drive0-backing' % (iotests.imgfmt))
          .launch())
 
-    enable_migration_events(vm_a, 'A')
+    vm_a.enable_migration_events('A')
 
     iotests.log('Launching destination VM...')
     (vm_b.add_blockdev('file,filename=%s,node-name=drive0-file' % (img_path))
@@ -72,7 +56,7 @@ with iotests.FilePath('img') as img_path, \
          .add_incoming("exec: cat '%s'" % (fifo_a))
          .launch())
 
-    enable_migration_events(vm_b, 'B')
+    vm_b.enable_migration_events('B')
 
     # Add a child node that was created after the parent node. The reverse case
     # is covered by the -blockdev options above.
@@ -85,9 +69,9 @@ with iotests.FilePath('img') as img_path, \
     iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo_a)))
     with iotests.Timeout(3, 'Migration does not complete'):
         # Wait for the source first (which includes setup=setup)
-        wait_migration(vm_a)
+        vm_a.wait_migration()
         # Wait for the destination second (which does not)
-        wait_migration(vm_b)
+        vm_b.wait_migration()
 
     iotests.log(vm_a.qmp('query-migrate')['return']['status'])
     iotests.log(vm_b.qmp('query-migrate')['return']['status'])
@@ -105,7 +89,7 @@ with iotests.FilePath('img') as img_path, \
          .add_incoming("exec: cat '%s'" % (fifo_b))
          .launch())
 
-    enable_migration_events(vm_a, 'A')
+    vm_a.enable_migration_events('A')
 
     iotests.log(vm_a.qmp('blockdev-snapshot', node='drive0-backing',
                          overlay='drive0'))
@@ -114,9 +98,9 @@ with iotests.FilePath('img') as img_path, \
     iotests.log(vm_b.qmp('migrate', uri='exec:cat >%s' % (fifo_b)))
     with iotests.Timeout(3, 'Migration does not complete'):
         # Wait for the source first (which includes setup=setup)
-        wait_migration(vm_b)
+        vm_b.wait_migration()
         # Wait for the destination second (which does not)
-        wait_migration(vm_a)
+        vm_a.wait_migration()
 
     iotests.log(vm_a.qmp('query-migrate')['return']['status'])
     iotests.log(vm_b.qmp('query-migrate')['return']['status'])
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index ce74177ab1..91172c39a5 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -583,6 +583,22 @@ class VM(qtest.QEMUQtestMachine):
             elif status == 'null':
                 return error
 
+    def enable_migration_events(self, name):
+        log('Enabling migration QMP events on %s...' % name)
+        log(self.qmp('migrate-set-capabilities', capabilities=[
+            {
+                'capability': 'events',
+                'state': True
+            }
+        ]))
+
+    def wait_migration(self):
+        while True:
+            event = self.event_wait('MIGRATION')
+            log(event, filters=[filter_qmp_event])
+            if event['data']['status'] == 'completed':
+                break
+
     def node_info(self, node_name):
         nodes = self.qmp('query-named-block-nodes')
         for x in nodes['return']:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests
  2019-08-01 15:17 [Qemu-devel] [PATCH 0/3] iotests: Test migration with filter nodes Kevin Wolf
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py Kevin Wolf
@ 2019-08-01 15:17 ` Kevin Wolf
  2019-08-01 17:57   ` Max Reitz
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes Kevin Wolf
  2 siblings, 1 reply; 11+ messages in thread
From: Kevin Wolf @ 2019-08-01 15:17 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

The part of iotests.main() that is related to the implementation of the
debug option -d and enables QEMU and QMP logging is not only useful in
tests that use the Python unittest framework, but also in tests that
work by comparing with a reference output.

Factor these parts out into iotests.init() and call it from the test
cases that currently lack support for debug output.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/194        |  1 +
 tests/qemu-iotests/202        |  1 +
 tests/qemu-iotests/203        |  2 ++
 tests/qemu-iotests/206        |  1 +
 tests/qemu-iotests/207        |  1 +
 tests/qemu-iotests/208        |  1 +
 tests/qemu-iotests/210        |  1 +
 tests/qemu-iotests/211        |  1 +
 tests/qemu-iotests/212        |  1 +
 tests/qemu-iotests/213        |  1 +
 tests/qemu-iotests/216        |  2 ++
 tests/qemu-iotests/218        |  1 +
 tests/qemu-iotests/219        |  1 +
 tests/qemu-iotests/222        |  1 +
 tests/qemu-iotests/224        |  2 ++
 tests/qemu-iotests/228        |  2 ++
 tests/qemu-iotests/234        |  2 ++
 tests/qemu-iotests/236        |  1 +
 tests/qemu-iotests/237        |  1 +
 tests/qemu-iotests/246        |  1 +
 tests/qemu-iotests/255        |  1 +
 tests/qemu-iotests/256        |  1 +
 tests/qemu-iotests/iotests.py | 23 +++++++++++++++--------
 23 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194
index d746ab1e21..cd6928fbd9 100755
--- a/tests/qemu-iotests/194
+++ b/tests/qemu-iotests/194
@@ -21,6 +21,7 @@
 
 import iotests
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2', 'qed', 'raw'])
 iotests.verify_platform(['linux'])
 
diff --git a/tests/qemu-iotests/202 b/tests/qemu-iotests/202
index 581ca34d79..86a3b94586 100755
--- a/tests/qemu-iotests/202
+++ b/tests/qemu-iotests/202
@@ -24,6 +24,7 @@
 
 import iotests
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2'])
 iotests.verify_platform(['linux'])
 
diff --git a/tests/qemu-iotests/203 b/tests/qemu-iotests/203
index 4874a1a0d8..fe25c249fb 100755
--- a/tests/qemu-iotests/203
+++ b/tests/qemu-iotests/203
@@ -27,6 +27,8 @@ import iotests
 iotests.verify_image_format(supported_fmts=['qcow2'])
 iotests.verify_platform(['linux'])
 
+iotests.init()
+
 with iotests.FilePath('disk0.img') as disk0_img_path, \
      iotests.FilePath('disk1.img') as disk1_img_path, \
      iotests.VM() as vm:
diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206
index 5bb738bf23..481e4b98ea 100755
--- a/tests/qemu-iotests/206
+++ b/tests/qemu-iotests/206
@@ -23,6 +23,7 @@
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2'])
 
 def blockdev_create(vm, options):
diff --git a/tests/qemu-iotests/207 b/tests/qemu-iotests/207
index ec8c1d06f0..57c1e900d2 100755
--- a/tests/qemu-iotests/207
+++ b/tests/qemu-iotests/207
@@ -24,6 +24,7 @@ import iotests
 import subprocess
 import re
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['raw'])
 iotests.verify_protocol(supported=['ssh'])
 
diff --git a/tests/qemu-iotests/208 b/tests/qemu-iotests/208
index 1e202388dc..3b2c732cd4 100755
--- a/tests/qemu-iotests/208
+++ b/tests/qemu-iotests/208
@@ -22,6 +22,7 @@
 
 import iotests
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['generic'])
 
 with iotests.FilePath('disk.img') as disk_img_path, \
diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210
index 565e3b7b9b..a90db1c067 100755
--- a/tests/qemu-iotests/210
+++ b/tests/qemu-iotests/210
@@ -23,6 +23,7 @@
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['luks'])
 iotests.verify_protocol(supported=['file'])
 
diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211
index 6afc894f76..e6a0bef332 100755
--- a/tests/qemu-iotests/211
+++ b/tests/qemu-iotests/211
@@ -23,6 +23,7 @@
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['vdi'])
 iotests.verify_protocol(supported=['file'])
 
diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212
index 42b74f208b..865674191c 100755
--- a/tests/qemu-iotests/212
+++ b/tests/qemu-iotests/212
@@ -23,6 +23,7 @@
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['parallels'])
 iotests.verify_protocol(supported=['file'])
 
diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213
index 5604f3cebb..8fb94147ff 100755
--- a/tests/qemu-iotests/213
+++ b/tests/qemu-iotests/213
@@ -23,6 +23,7 @@
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['vhdx'])
 iotests.verify_protocol(supported=['file'])
 
diff --git a/tests/qemu-iotests/216 b/tests/qemu-iotests/216
index 3c0ae54b44..adcb487fb4 100755
--- a/tests/qemu-iotests/216
+++ b/tests/qemu-iotests/216
@@ -22,6 +22,8 @@
 import iotests
 from iotests import log, qemu_img, qemu_io_silent
 
+iotests.init()
+
 # Need backing file support
 iotests.verify_image_format(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk'])
 iotests.verify_platform(['linux'])
diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218
index 2554d84581..18639020ee 100755
--- a/tests/qemu-iotests/218
+++ b/tests/qemu-iotests/218
@@ -29,6 +29,7 @@
 import iotests
 from iotests import log, qemu_img, qemu_io_silent
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2', 'raw'])
 
 
diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219
index e0c51662c0..c7265d12c5 100755
--- a/tests/qemu-iotests/219
+++ b/tests/qemu-iotests/219
@@ -21,6 +21,7 @@
 
 import iotests
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2'])
 
 img_size = 4 * 1024 * 1024
diff --git a/tests/qemu-iotests/222 b/tests/qemu-iotests/222
index 0ead56d574..bb2b8cc78a 100644
--- a/tests/qemu-iotests/222
+++ b/tests/qemu-iotests/222
@@ -24,6 +24,7 @@
 import iotests
 from iotests import log, qemu_img, qemu_io, qemu_io_silent
 
+iotests.init()
 iotests.verify_platform(['linux'])
 iotests.verify_image_format(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk',
                                             'vhdx', 'raw'])
diff --git a/tests/qemu-iotests/224 b/tests/qemu-iotests/224
index b4dfaa639f..00013473a8 100755
--- a/tests/qemu-iotests/224
+++ b/tests/qemu-iotests/224
@@ -25,6 +25,8 @@ from iotests import log, qemu_img, qemu_io_silent, filter_qmp_testfiles, \
                     filter_qmp_imgfmt
 import json
 
+iotests.init()
+
 # Need backing file support (for arbitrary backing formats)
 iotests.verify_image_format(supported_fmts=['qcow2', 'qcow', 'qed'])
 iotests.verify_platform(['linux'])
diff --git a/tests/qemu-iotests/228 b/tests/qemu-iotests/228
index 9a50afd205..9b9acf8be5 100755
--- a/tests/qemu-iotests/228
+++ b/tests/qemu-iotests/228
@@ -24,6 +24,8 @@ import iotests
 from iotests import log, qemu_img, filter_testfiles, filter_imgfmt, \
         filter_qmp_testfiles, filter_qmp_imgfmt
 
+iotests.init()
+
 # Need backing file and change-backing-file support
 iotests.verify_image_format(supported_fmts=['qcow2', 'qed'])
 iotests.verify_platform(['linux'])
diff --git a/tests/qemu-iotests/234 b/tests/qemu-iotests/234
index 34c818c485..17c03d2f6a 100755
--- a/tests/qemu-iotests/234
+++ b/tests/qemu-iotests/234
@@ -26,6 +26,8 @@ import os
 iotests.verify_image_format(supported_fmts=['qcow2'])
 iotests.verify_platform(['linux'])
 
+iotests.init()
+
 with iotests.FilePath('img') as img_path, \
      iotests.FilePath('backing') as backing_path, \
      iotests.FilePath('mig_fifo_a') as fifo_a, \
diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236
index 79a6381f8e..15ef48f0b6 100755
--- a/tests/qemu-iotests/236
+++ b/tests/qemu-iotests/236
@@ -22,6 +22,7 @@
 import iotests
 from iotests import log
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['generic'])
 size = 64 * 1024 * 1024
 granularity = 64 * 1024
diff --git a/tests/qemu-iotests/237 b/tests/qemu-iotests/237
index 06897f8c87..cbaaeed9eb 100755
--- a/tests/qemu-iotests/237
+++ b/tests/qemu-iotests/237
@@ -24,6 +24,7 @@ import math
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['vmdk'])
 
 def blockdev_create(vm, options):
diff --git a/tests/qemu-iotests/246 b/tests/qemu-iotests/246
index b0997a392f..7f6da5dced 100755
--- a/tests/qemu-iotests/246
+++ b/tests/qemu-iotests/246
@@ -22,6 +22,7 @@
 import iotests
 from iotests import log
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2'])
 size = 64 * 1024 * 1024 * 1024
 gran_small = 32 * 1024
diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255
index 3632d507d0..099617ab59 100755
--- a/tests/qemu-iotests/255
+++ b/tests/qemu-iotests/255
@@ -23,6 +23,7 @@
 import iotests
 from iotests import imgfmt
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2'])
 
 def blockdev_create(vm, options):
diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256
index c594a43205..e15f1b1a8a 100755
--- a/tests/qemu-iotests/256
+++ b/tests/qemu-iotests/256
@@ -23,6 +23,7 @@ import os
 import iotests
 from iotests import log
 
+iotests.init()
 iotests.verify_image_format(supported_fmts=['qcow2'])
 size = 64 * 1024 * 1024
 
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 91172c39a5..f2ad2b9749 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -858,10 +858,7 @@ def skip_if_unsupported(required_formats=[], read_only=False):
         return func_wrapper
     return skip_test_decorator
 
-def main(supported_fmts=[], supported_oses=['linux'], supported_cache_modes=[],
-         unsupported_fmts=[]):
-    '''Run tests'''
-
+def init():
     global debug
 
     # We are using TEST_DIR and QEMU_DEFAULT_MACHINE as proxies to
@@ -873,7 +870,19 @@ def main(supported_fmts=[], supported_oses=['linux'], supported_cache_modes=[],
         sys.exit(os.EX_USAGE)
 
     debug = '-d' in sys.argv
-    verbosity = 1
+    if debug:
+        sys.argv.remove('-d')
+
+    logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN))
+
+def main(supported_fmts=[], supported_oses=['linux'], supported_cache_modes=[],
+         unsupported_fmts=[]):
+    '''Run tests'''
+
+    global debug
+
+    init()
+
     verify_image_format(supported_fmts, unsupported_fmts)
     verify_platform(supported_oses)
     verify_cache_mode(supported_cache_modes)
@@ -881,8 +890,8 @@ def main(supported_fmts=[], supported_oses=['linux'], supported_cache_modes=[],
     if debug:
         output = sys.stdout
         verbosity = 2
-        sys.argv.remove('-d')
     else:
+        verbosity = 1
         # We need to filter out the time taken from the output so that
         # qemu-iotest can reliably diff the results against master output.
         if sys.version_info.major >= 3:
@@ -892,8 +901,6 @@ def main(supported_fmts=[], supported_oses=['linux'], supported_cache_modes=[],
             # 2.x's test runner emits.
             output = io.BytesIO()
 
-    logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN))
-
     class MyTestRunner(unittest.TextTestRunner):
         def __init__(self, stream=output, descriptions=True, verbosity=verbosity):
             unittest.TextTestRunner.__init__(self, stream, descriptions, verbosity)
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes
  2019-08-01 15:17 [Qemu-devel] [PATCH 0/3] iotests: Test migration with filter nodes Kevin Wolf
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py Kevin Wolf
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests Kevin Wolf
@ 2019-08-01 15:17 ` Kevin Wolf
  2019-08-01 18:50   ` Max Reitz
  2 siblings, 1 reply; 11+ messages in thread
From: Kevin Wolf @ 2019-08-01 15:17 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

This test case is motivated by commit 2b23f28639 ('block/copy-on-read:
Fix permissions for inactive node'). Instead of just testing
copy-on-read on migration, let's stack all sorts of filter nodes on top
of each other and try if the resulting VM can still migrate
successfully. For good measure, put everything into an iothread, because
why not?

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/262     | 84 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/262.out | 17 ++++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 102 insertions(+)
 create mode 100755 tests/qemu-iotests/262
 create mode 100644 tests/qemu-iotests/262.out

diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262
new file mode 100755
index 0000000000..dcd81a6059
--- /dev/null
+++ b/tests/qemu-iotests/262
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Creator/Owner: Kevin Wolf <kwolf@redhat.com>
+#
+# Test migration with filter drivers present. Keep everything in an
+# iothread just for fun.
+
+import iotests
+import os
+
+iotests.verify_image_format(supported_fmts=['qcow2'])
+iotests.verify_platform(['linux'])
+
+iotests.init()
+
+with iotests.FilePath('img') as img_path, \
+     iotests.FilePath('mig_fifo') as fifo, \
+     iotests.VM(path_suffix='a') as vm_a, \
+     iotests.VM(path_suffix='b') as vm_b:
+
+    def add_opts(vm):
+        vm.add_object('iothread,id=iothread0')
+        vm.add_object('throttle-group,id=tg0,x-bps-total=65536')
+        vm.add_blockdev('file,filename=%s,node-name=drive0-file' % (img_path))
+        vm.add_blockdev('%s,file=drive0-file,node-name=drive0-fmt' % (iotests.imgfmt))
+        vm.add_blockdev('copy-on-read,file=drive0-fmt,node-name=drive0-cor')
+        vm.add_blockdev('throttle,file=drive0-cor,node-name=drive0-throttle,throttle-group=tg0')
+        vm.add_blockdev('blkdebug,image=drive0-throttle,node-name=drive0-dbg')
+        vm.add_blockdev('null-co,node-name=null,read-zeroes=on')
+        vm.add_blockdev('blkverify,test=drive0-dbg,raw=null,node-name=drive0-verify')
+
+        if iotests.supports_quorum():
+            vm.add_blockdev('quorum,children.0=drive0-verify,vote-threshold=1,node-name=drive0-quorum')
+            root = "drive0-quorum"
+        else:
+            root = "drive0-verify"
+
+        vm.add_device('virtio-blk,drive=%s,iothread=iothread0' % root)
+
+    iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, img_path, '64M')
+
+    os.mkfifo(fifo)
+
+    iotests.log('Launching source VM...')
+    add_opts(vm_a)
+    vm_a.launch()
+
+    vm_a.enable_migration_events('A')
+
+    iotests.log('Launching destination VM...')
+    add_opts(vm_b)
+    vm_b.add_incoming("exec: cat '%s'" % (fifo))
+    vm_b.launch()
+
+    vm_b.enable_migration_events('B')
+
+    iotests.log('Starting migration to B...')
+    iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo)))
+    with iotests.Timeout(3, 'Migration does not complete'):
+        # Wait for the source first (which includes setup=setup)
+        vm_a.wait_migration()
+        # Wait for the destination second (which does not)
+        vm_b.wait_migration()
+
+    iotests.log(vm_a.qmp('query-migrate')['return']['status'])
+    iotests.log(vm_b.qmp('query-migrate')['return']['status'])
+
+    iotests.log(vm_a.qmp('query-status'))
+    iotests.log(vm_b.qmp('query-status'))
diff --git a/tests/qemu-iotests/262.out b/tests/qemu-iotests/262.out
new file mode 100644
index 0000000000..5a58e5e9f8
--- /dev/null
+++ b/tests/qemu-iotests/262.out
@@ -0,0 +1,17 @@
+Launching source VM...
+Enabling migration QMP events on A...
+{"return": {}}
+Launching destination VM...
+Enabling migration QMP events on B...
+{"return": {}}
+Starting migration to B...
+{"return": {}}
+{"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+completed
+completed
+{"return": {"running": false, "singlestep": false, "status": "postmigrate"}}
+{"return": {"running": true, "singlestep": false, "status": "running"}}
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index f13e5f2e23..71ba3c05dc 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -271,3 +271,4 @@
 254 rw backing quick
 255 rw quick
 256 rw quick
+262 rw quick migration
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py Kevin Wolf
@ 2019-08-01 17:44   ` Max Reitz
  0 siblings, 0 replies; 11+ messages in thread
From: Max Reitz @ 2019-08-01 17:44 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 478 bytes --]

On 01.08.19 17:17, Kevin Wolf wrote:
> 234 implements functions that are useful for doing migration between two
> VMs. Move them to iotests.py so that other test cases can use them, too.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/234        | 30 +++++++-----------------------
>  tests/qemu-iotests/iotests.py | 16 ++++++++++++++++
>  2 files changed, 23 insertions(+), 23 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests Kevin Wolf
@ 2019-08-01 17:57   ` Max Reitz
  2019-08-02 14:07     ` Kevin Wolf
  0 siblings, 1 reply; 11+ messages in thread
From: Max Reitz @ 2019-08-01 17:57 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: John Snow, qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 546 bytes --]

On 01.08.19 17:17, Kevin Wolf wrote:
> The part of iotests.main() that is related to the implementation of the
> debug option -d and enables QEMU and QMP logging is not only useful in
> tests that use the Python unittest framework, but also in tests that
> work by comparing with a reference output.
> 
> Factor these parts out into iotests.init() and call it from the test
> cases that currently lack support for debug output.

How does this relate to
https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg01212.html ?

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes
  2019-08-01 15:17 ` [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes Kevin Wolf
@ 2019-08-01 18:50   ` Max Reitz
  0 siblings, 0 replies; 11+ messages in thread
From: Max Reitz @ 2019-08-01 18:50 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 802 bytes --]

On 01.08.19 17:17, Kevin Wolf wrote:
> This test case is motivated by commit 2b23f28639 ('block/copy-on-read:
> Fix permissions for inactive node'). Instead of just testing
> copy-on-read on migration, let's stack all sorts of filter nodes on top
> of each other and try if the resulting VM can still migrate
> successfully. For good measure, put everything into an iothread, because
> why not?
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/262     | 84 ++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/262.out | 17 ++++++++
>  tests/qemu-iotests/group   |  1 +
>  3 files changed, 102 insertions(+)
>  create mode 100755 tests/qemu-iotests/262
>  create mode 100644 tests/qemu-iotests/262.out

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests
  2019-08-01 17:57   ` Max Reitz
@ 2019-08-02 14:07     ` Kevin Wolf
  2019-08-05 22:19       ` John Snow
  0 siblings, 1 reply; 11+ messages in thread
From: Kevin Wolf @ 2019-08-02 14:07 UTC (permalink / raw)
  To: Max Reitz; +Cc: John Snow, qemu-devel, qemu-block

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

Am 01.08.2019 um 19:57 hat Max Reitz geschrieben:
> On 01.08.19 17:17, Kevin Wolf wrote:
> > The part of iotests.main() that is related to the implementation of the
> > debug option -d and enables QEMU and QMP logging is not only useful in
> > tests that use the Python unittest framework, but also in tests that
> > work by comparing with a reference output.
> > 
> > Factor these parts out into iotests.init() and call it from the test
> > cases that currently lack support for debug output.
> 
> How does this relate to
> https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg01212.html ?

Hm, no idea? :-)

Looks like John's patch depends on some other patches which would then
conflict with mine, too, so maybe I'll just drop my patch and wait what
happens?

John, any opinion?

Kevin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests
  2019-08-02 14:07     ` Kevin Wolf
@ 2019-08-05 22:19       ` John Snow
  2019-08-06  9:51         ` Kevin Wolf
  0 siblings, 1 reply; 11+ messages in thread
From: John Snow @ 2019-08-05 22:19 UTC (permalink / raw)
  To: Kevin Wolf, Max Reitz; +Cc: qemu-devel, qemu-block



On 8/2/19 10:07 AM, Kevin Wolf wrote:
> Am 01.08.2019 um 19:57 hat Max Reitz geschrieben:
>> On 01.08.19 17:17, Kevin Wolf wrote:
>>> The part of iotests.main() that is related to the implementation of the
>>> debug option -d and enables QEMU and QMP logging is not only useful in
>>> tests that use the Python unittest framework, but also in tests that
>>> work by comparing with a reference output.
>>>
>>> Factor these parts out into iotests.init() and call it from the test
>>> cases that currently lack support for debug output.
>>
>> How does this relate to
>> https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg01212.html ?
> 
> Hm, no idea? :-)
> 
> Looks like John's patch depends on some other patches which would then
> conflict with mine, too, so maybe I'll just drop my patch and wait what
> happens?
> 
> John, any opinion?
> 
> Kevin
> 

My patches do roughly the same plus a little more. If you don't mind
waiting, I can take care of this for you when the tree reopens?

--js


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests
  2019-08-05 22:19       ` John Snow
@ 2019-08-06  9:51         ` Kevin Wolf
  2019-08-06 13:09           ` John Snow
  0 siblings, 1 reply; 11+ messages in thread
From: Kevin Wolf @ 2019-08-06  9:51 UTC (permalink / raw)
  To: John Snow; +Cc: qemu-devel, qemu-block, Max Reitz

Am 06.08.2019 um 00:19 hat John Snow geschrieben:
> 
> 
> On 8/2/19 10:07 AM, Kevin Wolf wrote:
> > Am 01.08.2019 um 19:57 hat Max Reitz geschrieben:
> >> On 01.08.19 17:17, Kevin Wolf wrote:
> >>> The part of iotests.main() that is related to the implementation of the
> >>> debug option -d and enables QEMU and QMP logging is not only useful in
> >>> tests that use the Python unittest framework, but also in tests that
> >>> work by comparing with a reference output.
> >>>
> >>> Factor these parts out into iotests.init() and call it from the test
> >>> cases that currently lack support for debug output.
> >>
> >> How does this relate to
> >> https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg01212.html ?
> > 
> > Hm, no idea? :-)
> > 
> > Looks like John's patch depends on some other patches which would then
> > conflict with mine, too, so maybe I'll just drop my patch and wait what
> > happens?
> > 
> > John, any opinion?
> > 
> > Kevin
> > 
> 
> My patches do roughly the same plus a little more. If you don't mind
> waiting, I can take care of this for you when the tree reopens?

Okay, I'll drop my patch then.

Kevin


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests
  2019-08-06  9:51         ` Kevin Wolf
@ 2019-08-06 13:09           ` John Snow
  0 siblings, 0 replies; 11+ messages in thread
From: John Snow @ 2019-08-06 13:09 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block, Max Reitz



On 8/6/19 5:51 AM, Kevin Wolf wrote:
> Am 06.08.2019 um 00:19 hat John Snow geschrieben:
>>
>>
>> On 8/2/19 10:07 AM, Kevin Wolf wrote:
>>> Am 01.08.2019 um 19:57 hat Max Reitz geschrieben:
>>>> On 01.08.19 17:17, Kevin Wolf wrote:
>>>>> The part of iotests.main() that is related to the implementation of the
>>>>> debug option -d and enables QEMU and QMP logging is not only useful in
>>>>> tests that use the Python unittest framework, but also in tests that
>>>>> work by comparing with a reference output.
>>>>>
>>>>> Factor these parts out into iotests.init() and call it from the test
>>>>> cases that currently lack support for debug output.
>>>>
>>>> How does this relate to
>>>> https://lists.nongnu.org/archive/html/qemu-block/2019-07/msg01212.html ?
>>>
>>> Hm, no idea? :-)
>>>
>>> Looks like John's patch depends on some other patches which would then
>>> conflict with mine, too, so maybe I'll just drop my patch and wait what
>>> happens?
>>>
>>> John, any opinion?
>>>
>>> Kevin
>>>
>>
>> My patches do roughly the same plus a little more. If you don't mind
>> waiting, I can take care of this for you when the tree reopens?
> 
> Okay, I'll drop my patch then.
> 
> Kevin
> 

Thank you! I will try to fix my bitmaps branch ASAP in light of the
recent fixes and get this staged in an easy to test way for the 4.2 branch.

--js


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-08-06 13:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 15:17 [Qemu-devel] [PATCH 0/3] iotests: Test migration with filter nodes Kevin Wolf
2019-08-01 15:17 ` [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py Kevin Wolf
2019-08-01 17:44   ` Max Reitz
2019-08-01 15:17 ` [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests Kevin Wolf
2019-08-01 17:57   ` Max Reitz
2019-08-02 14:07     ` Kevin Wolf
2019-08-05 22:19       ` John Snow
2019-08-06  9:51         ` Kevin Wolf
2019-08-06 13:09           ` John Snow
2019-08-01 15:17 ` [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes Kevin Wolf
2019-08-01 18:50   ` Max Reitz

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).