From nobody Fri Oct 3 15:49:19 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552077488909605.1457465768007; Fri, 8 Mar 2019 12:38:08 -0800 (PST) Received: from localhost ([127.0.0.1]:49581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2MFn-0007It-Qe for importer@patchew.org; Fri, 08 Mar 2019 15:38:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2M7L-0000u8-OH for qemu-devel@nongnu.org; Fri, 08 Mar 2019 15:29:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2M7J-0006xB-3N for qemu-devel@nongnu.org; Fri, 08 Mar 2019 15:29:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55640) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2M7G-0006oV-UT for qemu-devel@nongnu.org; Fri, 08 Mar 2019 15:29:15 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0043F30EBE92; Fri, 8 Mar 2019 20:29:09 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-160.bos.redhat.com [10.18.17.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86A4319492; Fri, 8 Mar 2019 20:29:08 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 8 Mar 2019 15:28:51 -0500 Message-Id: <20190308202858.26636-11-jsnow@redhat.com> In-Reply-To: <20190308202858.26636-1-jsnow@redhat.com> References: <20190308202858.26636-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 08 Mar 2019 20:29:09 +0000 (UTC) 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] [PULL 10/17] iotests: add busy/recording bit test to 124 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: peter.maydell@linaro.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This adds a simple test that ensures the busy bit works for push backups, as well as doubling as bonus test for incremental backups that get interrup= ted by EIO errors. Recording bit tests are already handled sufficiently by 236. Signed-off-by: John Snow Reviewed-by: Eric Blake Tested-by: Eric Blake Message-id: 20190223000614.13894-11-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/124 | 113 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/124.out | 4 +- 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 5aa1bf1bd6..80b356f7bb 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -634,6 +634,119 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): self.vm.shutdown() self.check_backups() =20 + def test_incremental_pause(self): + """ + Test an incremental backup that errors into a pause and is resumed. + """ + + drive0 =3D self.drives[0] + # NB: The blkdebug script here looks for a "flush, read, read" pat= tern. + # The flush occurs in hmp_io_writes, the first read in device_add,= and + # the last read during the block job. + result =3D self.vm.qmp('blockdev-add', + node_name=3Ddrive0['id'], + driver=3Ddrive0['fmt'], + file=3D{ + 'driver': 'blkdebug', + 'image': { + 'driver': 'file', + 'filename': drive0['file'] + }, + 'set-state': [{ + 'event': 'flush_to_disk', + 'state': 1, + 'new_state': 2 + },{ + 'event': 'read_aio', + 'state': 2, + 'new_state': 3 + }], + 'inject-error': [{ + 'event': 'read_aio', + 'errno': 5, + 'state': 3, + 'immediately': False, + 'once': True + }], + }) + self.assert_qmp(result, 'return', {}) + self.create_anchor_backup(drive0) + bitmap =3D self.add_bitmap('bitmap0', drive0) + + # Emulate guest activity + self.hmp_io_writes(drive0['id'], (('0xab', 0, 512), + ('0xfe', '16M', '256k'), + ('0x64', '32736k', '64k'))) + + # For the purposes of query-block visibility of bitmaps, add a dri= ve + # frontend after we've written data; otherwise we can't use hmp-io + result =3D self.vm.qmp("device_add", + id=3D"device0", + drive=3Ddrive0['id'], + driver=3D"virtio-blk") + self.assert_qmp(result, 'return', {}) + + # Bitmap Status Check + query =3D self.vm.qmp('query-block') + ret =3D [bmap for bmap in query['return'][0]['dirty-bitmaps'] + if bmap.get('name') =3D=3D bitmap.name][0] + self.assert_qmp(ret, 'count', 458752) + self.assert_qmp(ret, 'granularity', 65536) + self.assert_qmp(ret, 'status', 'active') + self.assert_qmp(ret, 'busy', False) + self.assert_qmp(ret, 'recording', True) + + # Start backup + parent, _ =3D bitmap.last_target() + target =3D self.prepare_backup(bitmap, parent) + res =3D self.vm.qmp('drive-backup', + job_id=3Dbitmap.drive['id'], + device=3Dbitmap.drive['id'], + sync=3D'incremental', + bitmap=3Dbitmap.name, + format=3Dbitmap.drive['fmt'], + target=3Dtarget, + mode=3D'existing', + on_source_error=3D'stop') + self.assert_qmp(res, 'return', {}) + + # Wait for the error + event =3D self.vm.event_wait(name=3D"BLOCK_JOB_ERROR", + match=3D{"data":{"device":bitmap.drive[= 'id']}}) + self.assert_qmp(event, 'data', {'device': bitmap.drive['id'], + 'action': 'stop', + 'operation': 'read'}) + + # Bitmap Status Check + query =3D self.vm.qmp('query-block') + ret =3D [bmap for bmap in query['return'][0]['dirty-bitmaps'] + if bmap.get('name') =3D=3D bitmap.name][0] + self.assert_qmp(ret, 'count', 458752) + self.assert_qmp(ret, 'granularity', 65536) + self.assert_qmp(ret, 'status', 'frozen') + self.assert_qmp(ret, 'busy', True) + self.assert_qmp(ret, 'recording', True) + + # Resume and check incremental backup for consistency + res =3D self.vm.qmp('block-job-resume', device=3Dbitmap.drive['id'= ]) + self.assert_qmp(res, 'return', {}) + self.wait_qmp_backup(bitmap.drive['id']) + + # Bitmap Status Check + query =3D self.vm.qmp('query-block') + ret =3D [bmap for bmap in query['return'][0]['dirty-bitmaps'] + if bmap.get('name') =3D=3D bitmap.name][0] + self.assert_qmp(ret, 'count', 0) + self.assert_qmp(ret, 'granularity', 65536) + self.assert_qmp(ret, 'status', 'active') + self.assert_qmp(ret, 'busy', False) + self.assert_qmp(ret, 'recording', True) + + # Finalize / Cleanup + self.make_reference_backup(bitmap) + self.vm.shutdown() + self.check_backups() + =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/124.out b/tests/qemu-iotests/124.out index e56cae021b..281b69efea 100644 --- a/tests/qemu-iotests/124.out +++ b/tests/qemu-iotests/124.out @@ -1,5 +1,5 @@ -........... +............ ---------------------------------------------------------------------- -Ran 11 tests +Ran 12 tests =20 OK --=20 2.17.2