From nobody Sat Feb 7 04:47:24 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 ARC-Seal: i=1; a=rsa-sha256; t=1571081595; cv=none; d=zoho.com; s=zohoarc; b=NDaylM8o03klWNG9cpDphysFtTQDf5tNH7JY6bKr+L58dV+tT/N0v2tyuT7zfLaI0PHOfQqJpXEbtvR1Ifvru9GljuQ9ZnFxkViEP/Q0Q/3gR6Cl9HQVhv7heCJObkxaQHJ/JLCYkDbTOf6vnyAxc99Wk9KaPQNOfL+XRITno3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571081595; h=Content-Type: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; bh=jpXeSZvHMibkg40LsuUV7anE7qH5hHBHO5PAuq54x/w=; b=N/MyvzIc9ijWnO4ZEr5y/NlmfXWhRdCWc4RvymQ+oR29eah1KQYu23VQHBCePSyiIYfC+zd6eo7rxsVTEz8+W99xfUKzcl5m8onXyPhYuEYYHzvcc7qFPDYy1+NG7wKm8aimRUb03xqbUZXFGLbDBMXl0Ggo59V0NwqWCiVsBUA= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571081595166308.94694723953955; Mon, 14 Oct 2019 12:33:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A53253A206; Mon, 14 Oct 2019 19:33:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A07B60C5E; Mon, 14 Oct 2019 19:33:13 +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 3A0534EE71; Mon, 14 Oct 2019 19:33:13 +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 x9EJUNZ4004494 for ; Mon, 14 Oct 2019 15:30:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id AC2A760CCD; Mon, 14 Oct 2019 19:30:23 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-152.bos.redhat.com [10.18.17.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54A7860BE2; Mon, 14 Oct 2019 19:30:22 +0000 (UTC) From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Mon, 14 Oct 2019 15:29:05 -0400 Message-Id: <20191014192909.16044-16-jsnow@redhat.com> In-Reply-To: <20191014192909.16044-1-jsnow@redhat.com> References: <20191014192909.16044-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Fam Zheng , Kevin Wolf , Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, Juan Quintela , libvir-list@redhat.com, John Snow , "Dr. David Alan Gilbert" , Max Reitz , Stefan Hajnoczi Subject: [libvirt] [PULL v2 15/19] iotests: add test 260 to check bitmap life after snapshot + commit 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 14 Oct 2019 19:33:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Message-id: 20190927122355.7344-8-vsementsov@virtuozzo.com Signed-off-by: John Snow --- tests/qemu-iotests/260 | 89 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/260.out | 52 ++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 142 insertions(+) create mode 100755 tests/qemu-iotests/260 create mode 100644 tests/qemu-iotests/260.out diff --git a/tests/qemu-iotests/260 b/tests/qemu-iotests/260 new file mode 100755 index 0000000000..4f6082c9d2 --- /dev/null +++ b/tests/qemu-iotests/260 @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# +# Tests for temporary external snapshot when we have bitmaps. +# +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. +# +# 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 . +# + +import iotests +from iotests import qemu_img_create, file_path, log, filter_qmp_event + +iotests.verify_image_format(supported_fmts=3D['qcow2']) + +base, top =3D file_path('base', 'top') +size =3D 64 * 1024 * 3 + + +def print_bitmap(msg, vm): + result =3D vm.qmp('query-block')['return'][0] + if 'dirty-bitmaps' in result: + bitmap =3D result['dirty-bitmaps'][0] + log('{}: name=3D{} dirty-clusters=3D{}'.format(msg, bitmap['name'], + bitmap['count'] // 64 // 1024)) + else: + log(msg + ': not found') + + +def test(persistent, restart): + assert persistent or not restart + log("\nTestcase {}persistent {} restart\n".format( + '' if persistent else 'non-', 'with' if restart else 'without'= )) + + qemu_img_create('-f', iotests.imgfmt, base, str(size)) + + vm =3D iotests.VM().add_drive(base) + vm.launch() + + vm.qmp_log('block-dirty-bitmap-add', node=3D'drive0', name=3D'bitmap0', + persistent=3Dpersistent) + vm.hmp_qemu_io('drive0', 'write 0 64K') + print_bitmap('initial bitmap', vm) + + vm.qmp_log('blockdev-snapshot-sync', device=3D'drive0', snapshot_file= =3Dtop, + format=3Diotests.imgfmt, filters=3D[iotests.filter_qmp_test= files]) + vm.hmp_qemu_io('drive0', 'write 64K 512') + print_bitmap('check that no bitmaps are in snapshot', vm) + + if restart: + log("... Restart ...") + vm.shutdown() + vm =3D iotests.VM().add_drive(top) + vm.launch() + + vm.qmp_log('block-commit', device=3D'drive0', top=3Dtop, + filters=3D[iotests.filter_qmp_testfiles]) + ev =3D vm.events_wait((('BLOCK_JOB_READY', None), + ('BLOCK_JOB_COMPLETED', None))) + log(filter_qmp_event(ev)) + if (ev['event'] =3D=3D 'BLOCK_JOB_COMPLETED'): + vm.shutdown() + log(vm.get_log()) + exit() + + vm.qmp_log('block-job-complete', device=3D'drive0') + ev =3D vm.event_wait('BLOCK_JOB_COMPLETED') + log(filter_qmp_event(ev)) + print_bitmap('check bitmap after commit', vm) + + vm.hmp_qemu_io('drive0', 'write 128K 64K') + print_bitmap('check updated bitmap', vm) + + vm.shutdown() + + +test(persistent=3DFalse, restart=3DFalse) +test(persistent=3DTrue, restart=3DFalse) +test(persistent=3DTrue, restart=3DTrue) diff --git a/tests/qemu-iotests/260.out b/tests/qemu-iotests/260.out new file mode 100644 index 0000000000..2f0d98d036 --- /dev/null +++ b/tests/qemu-iotests/260.out @@ -0,0 +1,52 @@ + +Testcase non-persistent without restart + +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "no= de": "drive0", "persistent": false}} +{"return": {}} +initial bitmap: name=3Dbitmap0 dirty-clusters=3D1 +{"execute": "blockdev-snapshot-sync", "arguments": {"device": "drive0", "f= ormat": "qcow2", "snapshot-file": "TEST_DIR/PID-top"}} +{"return": {}} +check that no bitmaps are in snapshot: not found +{"execute": "block-commit", "arguments": {"device": "drive0", "top": "TEST= _DIR/PID-top"}} +{"return": {}} +{"data": {"device": "drive0", "len": 65536, "offset": 65536, "speed": 0, "= type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds":= "USECS", "seconds": "SECS"}} +{"execute": "block-job-complete", "arguments": {"device": "drive0"}} +{"return": {}} +{"data": {"device": "drive0", "len": 65536, "offset": 65536, "speed": 0, "= type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsecon= ds": "USECS", "seconds": "SECS"}} +check bitmap after commit: name=3Dbitmap0 dirty-clusters=3D2 +check updated bitmap: name=3Dbitmap0 dirty-clusters=3D3 + +Testcase persistent without restart + +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "no= de": "drive0", "persistent": true}} +{"return": {}} +initial bitmap: name=3Dbitmap0 dirty-clusters=3D1 +{"execute": "blockdev-snapshot-sync", "arguments": {"device": "drive0", "f= ormat": "qcow2", "snapshot-file": "TEST_DIR/PID-top"}} +{"return": {}} +check that no bitmaps are in snapshot: not found +{"execute": "block-commit", "arguments": {"device": "drive0", "top": "TEST= _DIR/PID-top"}} +{"return": {}} +{"data": {"device": "drive0", "len": 65536, "offset": 65536, "speed": 0, "= type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds":= "USECS", "seconds": "SECS"}} +{"execute": "block-job-complete", "arguments": {"device": "drive0"}} +{"return": {}} +{"data": {"device": "drive0", "len": 65536, "offset": 65536, "speed": 0, "= type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsecon= ds": "USECS", "seconds": "SECS"}} +check bitmap after commit: name=3Dbitmap0 dirty-clusters=3D2 +check updated bitmap: name=3Dbitmap0 dirty-clusters=3D3 + +Testcase persistent with restart + +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "no= de": "drive0", "persistent": true}} +{"return": {}} +initial bitmap: name=3Dbitmap0 dirty-clusters=3D1 +{"execute": "blockdev-snapshot-sync", "arguments": {"device": "drive0", "f= ormat": "qcow2", "snapshot-file": "TEST_DIR/PID-top"}} +{"return": {}} +check that no bitmaps are in snapshot: not found +... Restart ... +{"execute": "block-commit", "arguments": {"device": "drive0", "top": "TEST= _DIR/PID-top"}} +{"return": {}} +{"data": {"device": "drive0", "len": 65536, "offset": 65536, "speed": 0, "= type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds":= "USECS", "seconds": "SECS"}} +{"execute": "block-job-complete", "arguments": {"device": "drive0"}} +{"return": {}} +{"data": {"device": "drive0", "len": 65536, "offset": 65536, "speed": 0, "= type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsecon= ds": "USECS", "seconds": "SECS"}} +check bitmap after commit: name=3Dbitmap0 dirty-clusters=3D2 +check updated bitmap: name=3Dbitmap0 dirty-clusters=3D3 diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 5805a79d9e..0c1e5ef414 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -273,6 +273,7 @@ 256 rw quick 257 rw 258 rw quick +260 rw auto quick 262 rw quick migration 263 rw quick 265 rw auto quick --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list