From nobody Mon Feb 9 07:55:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550880417936669.3729013077486; Fri, 22 Feb 2019 16:06:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3720519CF22; Sat, 23 Feb 2019 00:06:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07A531001E9D; Sat, 23 Feb 2019 00:06:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BA70C181A048; Sat, 23 Feb 2019 00:06:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1N06q61001756 for ; Fri, 22 Feb 2019 19:06:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 463A460BF1; Sat, 23 Feb 2019 00:06:52 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-206.bos.redhat.com [10.18.17.206]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05CFA60BF3; Sat, 23 Feb 2019 00:06:50 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Fri, 22 Feb 2019 19:06:14 -0500 Message-Id: <20190223000614.13894-11-jsnow@redhat.com> In-Reply-To: <20190223000614.13894-1-jsnow@redhat.com> References: <20190223000614.13894-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , vsementsov@virtuozzo.com, Juan Quintela , libvir-list@redhat.com, John Snow , Max Reitz , Stefan Hajnoczi , "Dr. David Alan Gilbert" Subject: [libvirt] [PATCH v3 10/10] iotests: add busy/recording bit test to 124 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 23 Feb 2019 00:06:56 +0000 (UTC) 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 --- tests/qemu-iotests/124 | 110 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/124.out | 4 +- 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 5aa1bf1bd6..30f12a2202 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -634,6 +634,116 @@ 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] + 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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list