From nobody Wed Nov 5 10:43:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534127819499297.6166481180594; Sun, 12 Aug 2018 19:36:59 -0700 (PDT) Received: from localhost ([::1]:37260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp2j2-000167-D2 for importer@patchew.org; Sun, 12 Aug 2018 22:36:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp2Tc-0003uh-S4 for qemu-devel@nongnu.org; Sun, 12 Aug 2018 22:21:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp2Tb-00005Z-SK for qemu-devel@nongnu.org; Sun, 12 Aug 2018 22:21:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40358 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fp2TX-0008QE-Cg; Sun, 12 Aug 2018 22:20:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0285540241C5; Mon, 13 Aug 2018 02:20:55 +0000 (UTC) Received: from localhost (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 981312026D6D; Mon, 13 Aug 2018 02:20:54 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 13 Aug 2018 04:20:06 +0200 Message-Id: <20180813022006.7216-18-mreitz@redhat.com> In-Reply-To: <20180813022006.7216-1-mreitz@redhat.com> References: <20180813022006.7216-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 13 Aug 2018 02:20:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 13 Aug 2018 02:20:55 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mreitz@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 17/17] iotests: Add test for active mirror with COR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Jeff Cody , Fam Zheng , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Reitz --- tests/qemu-iotests/151 | 56 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 4 +-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index fe53b9f446..e5515c2d37 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -114,6 +114,62 @@ class TestActiveMirror(iotests.QMPTestCase): def testActiveIOFlushed(self): self.doActiveIO(True) =20 + def testCOR(self): + # Fill the source image + self.vm.hmp_qemu_io('source', + 'write -P 1 0 %i' % self.image_len); + + # Start some background requests + for offset in range(0, self.image_len / 2, 1024 * 1024): + self.vm.hmp_qemu_io('source', 'aio_write -P 2 %i 1M' % offset) + + # Start the block job + result =3D self.vm.qmp('blockdev-mirror', + job_id=3D'mirror', + filter_node_name=3D'mirror-node', + device=3D'source-node', + target=3D'target-node', + sync=3D'full', + copy_mode=3D'write-blocking') + self.assert_qmp(result, 'return', {}) + + # Stop background request processing + result =3D self.vm.qmp('job-pause', id=3D'mirror') + + result =3D self.vm.qmp('blockdev-add', + node_name=3D'cor-node', + driver=3D'copy-on-read', + file=3D'mirror-node') + self.assert_qmp(result, 'return', {}) + + # Now read everything, thus synchronously copying it to the + # target + for offset in range(0, self.image_len, 1024 * 1024): + self.vm.hmp_qemu_io('cor-node', 'read %i 1M' % offset) + + # Resuming the job should make it READY immediately, because + # the read requests from cor-node above should have copied + # everything to target already. + # Set the job speed to 1 before resuming it, so that we can + # see that the READY event really comes immediately. + + result =3D self.vm.qmp('block-job-set-speed', + device=3D'mirror', + speed=3D1) + self.assert_qmp(result, 'return', {}) + + result =3D self.vm.qmp('job-resume', id=3D'mirror') + self.assert_qmp(result, 'return', {}) + + # Wait for the READY event; if we get a timeout here, reading + # from cor-node has failed to copy something to target + self.vm.event_wait(name=3D'BLOCK_JOB_READY', timeout=3D5.0) + + self.vm.hmp_qemu_io('source', 'aio_flush') + self.potential_writes_in_flight =3D False + + self.complete_and_wait(drive=3D'mirror', wait_ready=3DFalse) + =20 =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out index fbc63e62f8..8d7e996700 100644 --- a/tests/qemu-iotests/151.out +++ b/tests/qemu-iotests/151.out @@ -1,5 +1,5 @@ -.. +... ---------------------------------------------------------------------- -Ran 2 tests +Ran 3 tests =20 OK --=20 2.17.1