From nobody Sun Oct 5 19:23:32 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1613172596; cv=none; d=zohomail.com; s=zohoarc; b=m5R2kfk2S6JeqoelkqxCBM7ISIaNPnzsEhsdk05QAZtMJk1kwsxYeKAvG8DxGXS1BRhPW7NMVmwjOEtuNTnLEuCcJdmPGcDYA2Usg8ATygxbbtCubkrDe+h3WLo+14TsWcqW66wpALRkdaw/qlCekN7bVRtRjBmrHfWAoMjPNkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613172596; 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=YStRyw6rkOpcj3BTBnkNzMA84120O4F+Rp95ueaU2yg=; b=Q2Mhy+64tEwwG00bocGgR1WpqS0cNg0KteSfnxFxF06NnGN4/sld6WPaoucJNsyDFqSF+rs/2Uc2NFQr8FY8sVKFi9OGPJ7K/haOVlg2lNO+so2BJdJSzoTfNFYx1si2WAy4t/PN1/JqrCzBMt6N42fYqKRjdkDkht48D+6i2O4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1613172596580718.0593512394744; Fri, 12 Feb 2021 15:29:56 -0800 (PST) Received: from localhost ([::1]:53198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAhsm-0002Ro-2K for importer@patchew.org; Fri, 12 Feb 2021 18:29:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAhkz-000402-7h for qemu-devel@nongnu.org; Fri, 12 Feb 2021 18:21:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lAhkx-0005o3-6p for qemu-devel@nongnu.org; Fri, 12 Feb 2021 18:21:48 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-_Hnoux4aNw2slcvWK9wSKw-1; Fri, 12 Feb 2021 18:21:43 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1D03803F47; Fri, 12 Feb 2021 23:21:42 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-150.phx2.redhat.com [10.3.114.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5010C1F04C; Fri, 12 Feb 2021 23:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613172105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YStRyw6rkOpcj3BTBnkNzMA84120O4F+Rp95ueaU2yg=; b=T8hZexWxZaZloJhVBeVP1yJ2eozTvUmD/mW7qcJUg3JM/d1yb/aKkHYNwJv6uHSE9SFY+b W9K/ubf5OY2SZQsNvChJVKiL9EkrwOfkQmmV5eqpaaNPFBd9ZGrqqrht4l6NnGjK0VlpWm Zux78tgQDUvaqJNg1rPWFiMTIjDMT3Q= X-MC-Unique: _Hnoux4aNw2slcvWK9wSKw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 3/5] qemu-iotests: 300: Add test case for modifying persistence of bitmap Date: Fri, 12 Feb 2021 17:21:32 -0600 Message-Id: <20210212232134.1462756-4-eblake@redhat.com> In-Reply-To: <20210212232134.1462756-1-eblake@redhat.com> References: <20210212232134.1462756-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.569, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , Peter Krempa , "open list:Block layer core" , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Krempa Verify that the modification of the bitmap persistence over migration which is controlled via BitmapMigrationBitmapAliasTransform works properly. Based on TestCrossAliasMigration Signed-off-by: Peter Krempa Message-Id: Reviewed-by: Eric Blake [eblake: Adjust test for explicit read_zeroes=3DFalse] Signed-off-by: Eric Blake --- tests/qemu-iotests/300 | 93 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/300.out | 4 +- 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index 43264d883d79..63036f6a6e13 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -600,6 +600,99 @@ class TestCrossAliasMigration(TestDirtyBitmapMigration= ): self.verify_dest_has_all_bitmaps() self.verify_dest_error(None) +class TestAliasTransformMigration(TestDirtyBitmapMigration): + """ + Tests the 'transform' option which modifies bitmap persistence on migr= ation. + """ + + src_node_name =3D 'node-a' + dst_node_name =3D 'node-b' + src_bmap_name =3D 'bmap-a' + dst_bmap_name =3D 'bmap-b' + + def setUp(self) -> None: + TestDirtyBitmapMigration.setUp(self) + + # Now create another block device and let both have two bitmaps ea= ch + result =3D self.vm_a.qmp('blockdev-add', + node_name=3D'node-b', driver=3D'null-co', + read_zeroes=3DFalse) + self.assert_qmp(result, 'return', {}) + + result =3D self.vm_b.qmp('blockdev-add', + node_name=3D'node-a', driver=3D'null-co', + read_zeroes=3DFalse) + self.assert_qmp(result, 'return', {}) + + bmaps_to_add =3D (('node-a', 'bmap-b'), + ('node-b', 'bmap-a'), + ('node-b', 'bmap-b')) + + for (node, bmap) in bmaps_to_add: + result =3D self.vm_a.qmp('block-dirty-bitmap-add', + node=3Dnode, name=3Dbmap) + self.assert_qmp(result, 'return', {}) + + @staticmethod + def transform_mapping() -> BlockBitmapMapping: + return [ + { + 'node-name': 'node-a', + 'alias': 'node-a', + 'bitmaps': [ + { + 'name': 'bmap-a', + 'alias': 'bmap-a', + 'transform': + { + 'persistent': True + } + }, + { + 'name': 'bmap-b', + 'alias': 'bmap-b' + } + ] + }, + { + 'node-name': 'node-b', + 'alias': 'node-b', + 'bitmaps': [ + { + 'name': 'bmap-a', + 'alias': 'bmap-a' + }, + { + 'name': 'bmap-b', + 'alias': 'bmap-b' + } + ] + } + ] + + def verify_dest_bitmap_state(self) -> None: + bitmaps =3D self.vm_b.query_bitmaps() + + for node in bitmaps: + bitmaps[node] =3D sorted(((bmap['name'], bmap['persistent']) f= or bmap in bitmaps[node])) + + self.assertEqual(bitmaps, + {'node-a': [('bmap-a', True), ('bmap-b', False)], + 'node-b': [('bmap-a', False), ('bmap-b', False)]= }) + + def test_transform_on_src(self) -> None: + self.set_mapping(self.vm_a, self.transform_mapping()) + + self.migrate() + self.verify_dest_bitmap_state() + self.verify_dest_error(None) + + def test_transform_on_dst(self) -> None: + self.set_mapping(self.vm_b, self.transform_mapping()) + + self.migrate() + self.verify_dest_bitmap_state() + self.verify_dest_error(None) if __name__ =3D=3D '__main__': iotests.main(supported_protocols=3D['file']) diff --git a/tests/qemu-iotests/300.out b/tests/qemu-iotests/300.out index cafb8161f7b1..12e9ab7d571b 100644 --- a/tests/qemu-iotests/300.out +++ b/tests/qemu-iotests/300.out @@ -1,5 +1,5 @@ -..................................... +....................................... ---------------------------------------------------------------------- -Ran 37 tests +Ran 39 tests OK --=20 2.30.1