From nobody Wed May 8 00:44:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1564672782; cv=none; d=zoho.com; s=zohoarc; b=OgH8CetWxtfOWux0po2qz+msO8+/I3Vpjxz35iFEXItW9qvWVV7D+Hmdmy94b4Np60EHSPi5yQMOrTaGdKyCe9u+8l4zcY4UIbukBUXoA7H9EoYF1nIWGilQc5ogAFvCd7Qk/U8ef1dHlEpywbNqVAACfRr43FZdQb8V8sBTPK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564672782; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jbnzA1KB+tKU6SW37XIhf527t4CDLPMw6NuQ+278F9k=; b=BOgnzgwnNmncmzDdXzKkhL2RTlbqM6kkpXttdIqOFlGq9hkFuQnKBUkOMRYgw4oppfFh7OROaiwqzdw+3mmRxwgABh1Tc/DdBRcCDNYIxoyd/InCs1CzY6OvRJn0rqs7BP79akvhyzUfT8P08MoagXGv54AXUmlyz0qd6QcaFGQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564672782917195.1470014033598; Thu, 1 Aug 2019 08:19:42 -0700 (PDT) Received: from localhost ([::1]:56694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htCre-0006RB-Fo for importer@patchew.org; Thu, 01 Aug 2019 11:19:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36049) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htCq5-00051Q-Ub for qemu-devel@nongnu.org; Thu, 01 Aug 2019 11:17:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htCq4-0000gE-6c for qemu-devel@nongnu.org; Thu, 01 Aug 2019 11:17:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51870) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1htCq1-0000ab-6g; Thu, 01 Aug 2019 11:17:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A1FF3086211; Thu, 1 Aug 2019 15:17:52 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-98.ams2.redhat.com [10.36.117.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B96E5D712; Thu, 1 Aug 2019 15:17:49 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 1 Aug 2019 17:17:42 +0200 Message-Id: <20190801151744.798-2-kwolf@redhat.com> In-Reply-To: <20190801151744.798-1-kwolf@redhat.com> References: <20190801151744.798-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 01 Aug 2019 15:17:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] iotests: Move migration helpers to iotests.py X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Max Reitz --- 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=3D['qcow2']) iotests.verify_platform(['linux']) =20 -def enable_migration_events(vm, name): - iotests.log('Enabling migration QMP events on %s...' % name) - iotests.log(vm.qmp('migrate-set-capabilities', capabilities=3D[ - { - 'capability': 'events', - 'state': True - } - ])) - -def wait_migration(vm): - while True: - event =3D vm.event_wait('MIGRATION') - iotests.log(event, filters=3D[iotests.filter_qmp_event]) - if event['data']['status'] =3D=3D '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=3Ddrive0-backing-file,node-name=3Ddrive0-b= acking' % (iotests.imgfmt)) .launch()) =20 - enable_migration_events(vm_a, 'A') + vm_a.enable_migration_events('A') =20 iotests.log('Launching destination VM...') (vm_b.add_blockdev('file,filename=3D%s,node-name=3Ddrive0-file' % (img= _path)) @@ -72,7 +56,7 @@ with iotests.FilePath('img') as img_path, \ .add_incoming("exec: cat '%s'" % (fifo_a)) .launch()) =20 - enable_migration_events(vm_b, 'B') + vm_b.enable_migration_events('B') =20 # 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=3D'exec:cat >%s' % (fifo_a))) with iotests.Timeout(3, 'Migration does not complete'): # Wait for the source first (which includes setup=3Dsetup) - wait_migration(vm_a) + vm_a.wait_migration() # Wait for the destination second (which does not) - wait_migration(vm_b) + vm_b.wait_migration() =20 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()) =20 - enable_migration_events(vm_a, 'A') + vm_a.enable_migration_events('A') =20 iotests.log(vm_a.qmp('blockdev-snapshot', node=3D'drive0-backing', overlay=3D'drive0')) @@ -114,9 +98,9 @@ with iotests.FilePath('img') as img_path, \ iotests.log(vm_b.qmp('migrate', uri=3D'exec:cat >%s' % (fifo_b))) with iotests.Timeout(3, 'Migration does not complete'): # Wait for the source first (which includes setup=3Dsetup) - wait_migration(vm_b) + vm_b.wait_migration() # Wait for the destination second (which does not) - wait_migration(vm_a) + vm_a.wait_migration() =20 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 =3D=3D 'null': return error =20 + def enable_migration_events(self, name): + log('Enabling migration QMP events on %s...' % name) + log(self.qmp('migrate-set-capabilities', capabilities=3D[ + { + 'capability': 'events', + 'state': True + } + ])) + + def wait_migration(self): + while True: + event =3D self.event_wait('MIGRATION') + log(event, filters=3D[filter_qmp_event]) + if event['data']['status'] =3D=3D 'completed': + break + def node_info(self, node_name): nodes =3D self.qmp('query-named-block-nodes') for x in nodes['return']: --=20 2.20.1 From nobody Wed May 8 00:44:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1564672806; cv=none; d=zoho.com; s=zohoarc; b=VCUYgrzD7affxnhC1q+8wlFvQdwVP6N6+OijMsT0wP4QF0YhWCFF5Z0/0ICTqS7sVZJJWFpC8Ll8jX+tce+g85JkgV99BuIk2QGtyf2sZzzFCbhWV0hSAywvgNDp3eW7tLOxhjtscBBBQRRKSQ/723pbB0jC/xo1SYD/kNlyDwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564672806; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ojj6/FAkrsX8yhoOHcjTdkr+SzqiHtrTYj4AMkCxQDA=; b=LIjgtkc5v1kt3OzE/CI9nYB4ruH3hfu4388dEB0uc0cQRUUpaNJzx4dsNTJD96TWCcCtS4ID3uTK9OhiEbbkALPJqLfqBLXaFcTx8GkHPS3fGmylfMzNFJALnLOiKvMepm6lfZb/yRgcu9M252w6maO1S72tLWUqPsLx2t9W1v0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156467280673881.11541890858427; Thu, 1 Aug 2019 08:20:06 -0700 (PDT) Received: from localhost ([::1]:56696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htCs7-0006hn-O1 for importer@patchew.org; Thu, 01 Aug 2019 11:20:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36083) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htCqC-0005BT-T2 for qemu-devel@nongnu.org; Thu, 01 Aug 2019 11:18:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htCqB-0000k4-3C for qemu-devel@nongnu.org; Thu, 01 Aug 2019 11:18:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34584) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1htCq7-0000i7-5w; Thu, 01 Aug 2019 11:17:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C1853002F44; Thu, 1 Aug 2019 15:17:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-98.ams2.redhat.com [10.36.117.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7DA062675; Thu, 1 Aug 2019 15:17:52 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 1 Aug 2019 17:17:43 +0200 Message-Id: <20190801151744.798-3-kwolf@redhat.com> In-Reply-To: <20190801151744.798-1-kwolf@redhat.com> References: <20190801151744.798-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 01 Aug 2019 15:17:58 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/3] iotests: Enable -d for Python non-unittest tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 --- 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 @@ =20 import iotests =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2', 'qed', 'raw']) iotests.verify_platform(['linux']) =20 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 @@ =20 import iotests =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2']) iotests.verify_platform(['linux']) =20 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=3D['qcow2']) iotests.verify_platform(['linux']) =20 +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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['raw']) iotests.verify_protocol(supported=3D['ssh']) =20 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 @@ =20 import iotests =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['generic']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['luks']) iotests.verify_protocol(supported=3D['file']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['vdi']) iotests.verify_protocol(supported=3D['file']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['parallels']) iotests.verify_protocol(supported=3D['file']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['vhdx']) iotests.verify_protocol(supported=3D['file']) =20 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 =20 +iotests.init() + # Need backing file support iotests.verify_image_format(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vmd= k']) 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2', 'raw']) =20 =20 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 @@ =20 import iotests =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2']) =20 img_size =3D 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 =20 +iotests.init() iotests.verify_platform(['linux']) iotests.verify_image_format(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vmd= k', '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 =20 +iotests.init() + # Need backing file support (for arbitrary backing formats) iotests.verify_image_format(supported_fmts=3D['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 =20 +iotests.init() + # Need backing file and change-backing-file support iotests.verify_image_format(supported_fmts=3D['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=3D['qcow2']) iotests.verify_platform(['linux']) =20 +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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['generic']) size =3D 64 * 1024 * 1024 granularity =3D 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['vmdk']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2']) size =3D 64 * 1024 * 1024 * 1024 gran_small =3D 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2']) =20 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 =20 +iotests.init() iotests.verify_image_format(supported_fmts=3D['qcow2']) size =3D 64 * 1024 * 1024 =20 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=3D[], read_on= ly=3DFalse): return func_wrapper return skip_test_decorator =20 -def main(supported_fmts=3D[], supported_oses=3D['linux'], supported_cache_= modes=3D[], - unsupported_fmts=3D[]): - '''Run tests''' - +def init(): global debug =20 # We are using TEST_DIR and QEMU_DEFAULT_MACHINE as proxies to @@ -873,7 +870,19 @@ def main(supported_fmts=3D[], supported_oses=3D['linux= '], supported_cache_modes=3D[], sys.exit(os.EX_USAGE) =20 debug =3D '-d' in sys.argv - verbosity =3D 1 + if debug: + sys.argv.remove('-d') + + logging.basicConfig(level=3D(logging.DEBUG if debug else logging.WARN)) + +def main(supported_fmts=3D[], supported_oses=3D['linux'], supported_cache_= modes=3D[], + unsupported_fmts=3D[]): + '''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=3D[], supported_oses=3D['linux'= ], supported_cache_modes=3D[], if debug: output =3D sys.stdout verbosity =3D 2 - sys.argv.remove('-d') else: + verbosity =3D 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 >=3D 3: @@ -892,8 +901,6 @@ def main(supported_fmts=3D[], supported_oses=3D['linux'= ], supported_cache_modes=3D[], # 2.x's test runner emits. output =3D io.BytesIO() =20 - logging.basicConfig(level=3D(logging.DEBUG if debug else logging.WARN)) - class MyTestRunner(unittest.TextTestRunner): def __init__(self, stream=3Doutput, descriptions=3DTrue, verbosity= =3Dverbosity): unittest.TextTestRunner.__init__(self, stream, descriptions, v= erbosity) --=20 2.20.1 From nobody Wed May 8 00:44:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1564672862; cv=none; d=zoho.com; s=zohoarc; b=NQV6WPeLbphCxo+HypqJfmGVxWWC6MxN08QjhrfmYS18T4ydNHauQN6gOYajHjm6e9xTJSox0Kx8uwFsRmIrMUyVURqPNj2H4BirDbEu+92MOcbpfC2897FngtdpI1/PQtNH34AbaWKVcAKi1WuieFLBAi9IBdYQmAbW34w8a54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564672862; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=tkiGu9IxjBwBRZjOUbKXvGvqCwS33QwEplJ+cU15GIo=; b=ZXWURErfrmZyVupLY5eCRmF6J3uwpBdvHU+uOWHSKOTCyDEYhmglZR/af6Wy57yW5TdM/5p7G34SZ7nu5wiLtLbg5UKtUt86NOO3NRDn6Q9JfVa/GePOeudBs/kZ2x6pGUlAAgmJo93lWt7FR+ZXTkl2ynGQcZ6AkuqhRYJHt/c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564672862441790.620705486256; Thu, 1 Aug 2019 08:21:02 -0700 (PDT) Received: from localhost ([::1]:56712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htCt3-0000QZ-Hw for importer@patchew.org; Thu, 01 Aug 2019 11:21:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36127) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htCqJ-0005TQ-OW for qemu-devel@nongnu.org; Thu, 01 Aug 2019 11:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htCqI-0000w4-CN for qemu-devel@nongnu.org; Thu, 01 Aug 2019 11:18:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1htCqF-0000v0-7L; Thu, 01 Aug 2019 11:18:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9099CC08EC18; Thu, 1 Aug 2019 15:18:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-98.ams2.redhat.com [10.36.117.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id A903E5D712; Thu, 1 Aug 2019 15:17:58 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 1 Aug 2019 17:17:44 +0200 Message-Id: <20190801151744.798-4-kwolf@redhat.com> In-Reply-To: <20190801151744.798-1-kwolf@redhat.com> References: <20190801151744.798-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 01 Aug 2019 15:18:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] iotests: Test migration with all kinds of filter nodes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Max Reitz --- 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 . +# +# Creator/Owner: Kevin Wolf +# +# Test migration with filter drivers present. Keep everything in an +# iothread just for fun. + +import iotests +import os + +iotests.verify_image_format(supported_fmts=3D['qcow2']) +iotests.verify_platform(['linux']) + +iotests.init() + +with iotests.FilePath('img') as img_path, \ + iotests.FilePath('mig_fifo') as fifo, \ + iotests.VM(path_suffix=3D'a') as vm_a, \ + iotests.VM(path_suffix=3D'b') as vm_b: + + def add_opts(vm): + vm.add_object('iothread,id=3Diothread0') + vm.add_object('throttle-group,id=3Dtg0,x-bps-total=3D65536') + vm.add_blockdev('file,filename=3D%s,node-name=3Ddrive0-file' % (im= g_path)) + vm.add_blockdev('%s,file=3Ddrive0-file,node-name=3Ddrive0-fmt' % (= iotests.imgfmt)) + vm.add_blockdev('copy-on-read,file=3Ddrive0-fmt,node-name=3Ddrive0= -cor') + vm.add_blockdev('throttle,file=3Ddrive0-cor,node-name=3Ddrive0-thr= ottle,throttle-group=3Dtg0') + vm.add_blockdev('blkdebug,image=3Ddrive0-throttle,node-name=3Ddriv= e0-dbg') + vm.add_blockdev('null-co,node-name=3Dnull,read-zeroes=3Don') + vm.add_blockdev('blkverify,test=3Ddrive0-dbg,raw=3Dnull,node-name= =3Ddrive0-verify') + + if iotests.supports_quorum(): + vm.add_blockdev('quorum,children.0=3Ddrive0-verify,vote-thresh= old=3D1,node-name=3Ddrive0-quorum') + root =3D "drive0-quorum" + else: + root =3D "drive0-verify" + + vm.add_device('virtio-blk,drive=3D%s,iothread=3Diothread0' % 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=3D'exec:cat >%s' % (fifo))) + with iotests.Timeout(3, 'Migration does not complete'): + # Wait for the source first (which includes setup=3Dsetup) + 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": {"microse= conds": "USECS", "seconds": "SECS"}} +{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"mic= roseconds": "USECS", "seconds": "SECS"}} +{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"mic= roseconds": "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 --=20 2.20.1