From nobody Mon Feb 9 02:28:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617985387; cv=none; d=zohomail.com; s=zohoarc; b=KUBetWtosmUX6QFkLmMDYRSv34YIYSHS1XM07Es8fEyMEa5lUoWCMh2z4S8tHh27sluxS3kfCnhBtRvwMy9x18jzrEP1e2eLXlN+WIb2P4Rx+2dvbNXZEHH92WJ8VmxNaGaBK98Mp9YSMVNpDWY/KuzBXj/KYBw+dCti8JtVNOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617985387; 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=ZSXeO8oZCR3bRAXAIlADUmJrrUFAZHUJqPzVBpHGJ3Y=; b=l8em8mxykBD06brH9kbW4S49rj/B1wrPtrNMVUiHheNPCMQFELpg1LjjeXcab4yvyAY5CbBbWfzZHqbxQtMp4l5JwEsjOpzrLm6hEu3XmAU8L6RDx/ttuw0VdGmzg0+Wgp7kNEmNyjVFQvls7hNOjnqFUhLiFTWcYrXGNTXUK7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 161798538797436.72266646333037; Fri, 9 Apr 2021 09:23:07 -0700 (PDT) Received: from localhost ([::1]:46862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUtuU-0000Ui-Uw for importer@patchew.org; Fri, 09 Apr 2021 12:23:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUtnr-0007gS-IH for qemu-devel@nongnu.org; Fri, 09 Apr 2021 12:16:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUtnj-0003Lo-7M for qemu-devel@nongnu.org; Fri, 09 Apr 2021 12:16:15 -0400 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-466-5TmMWFBgMzGuQNqnmOHCag-1; Fri, 09 Apr 2021 12:16:04 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C40E188352C; Fri, 9 Apr 2021 16:16:03 +0000 (UTC) Received: from merkur.fritz.box (ovpn-115-63.ams2.redhat.com [10.36.115.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A4385D6A1; Fri, 9 Apr 2021 16:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617984966; 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=ZSXeO8oZCR3bRAXAIlADUmJrrUFAZHUJqPzVBpHGJ3Y=; b=htp9XgFgu1YDBz2kfqw4A0XUawYXIPmKY1K7xr8WcV9z0ldgHAJ/vDY2pVr6fCFrEuoo/g 1Mwc6nEK9IhbiHH1+KkfqOO8gcH1S94asDZoqTE7YSFywRgF1rMNwTYdj0NMAmfPBOU4WP xANCc9fARnvM3Y+2dcUlB5EU8j4yP3I= X-MC-Unique: 5TmMWFBgMzGuQNqnmOHCag-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 04/10] iotests: add test for removing persistent bitmap from backing file Date: Fri, 9 Apr 2021 18:15:42 +0200 Message-Id: <20210409161548.341297-5-kwolf@redhat.com> In-Reply-To: <20210409161548.341297-1-kwolf@redhat.com> References: <20210409161548.341297-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Just demonstrate one of x-blockdev-reopen usecases. We can't simply remove persistent bitmap from RO node (for example from backing file), as we need to remove it from the image too. So, we should reopen the node first. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20210401161522.8001-1-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- .../tests/remove-bitmap-from-backing | 69 +++++++++++++++++++ .../tests/remove-bitmap-from-backing.out | 6 ++ 2 files changed, 75 insertions(+) create mode 100755 tests/qemu-iotests/tests/remove-bitmap-from-backing create mode 100644 tests/qemu-iotests/tests/remove-bitmap-from-backing.out diff --git a/tests/qemu-iotests/tests/remove-bitmap-from-backing b/tests/qe= mu-iotests/tests/remove-bitmap-from-backing new file mode 100755 index 0000000000..0ea4c36507 --- /dev/null +++ b/tests/qemu-iotests/tests/remove-bitmap-from-backing @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +# +# Test removing persistent bitmap from backing +# +# Copyright (c) 2021 Virtuozzo International GmbH. +# +# 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 log, qemu_img_create, qemu_img, qemu_img_pipe + +iotests.script_initialize(supported_fmts=3D['qcow2']) + +top, base =3D iotests.file_path('top', 'base') +size =3D '1M' + +assert qemu_img_create('-f', iotests.imgfmt, base, size) =3D=3D 0 +assert qemu_img_create('-f', iotests.imgfmt, '-b', base, + '-F', iotests.imgfmt, top, size) =3D=3D 0 + +assert qemu_img('bitmap', '--add', base, 'bitmap0') =3D=3D 0 +# Just assert that our method of checking bitmaps in the image works. +assert 'bitmaps' in qemu_img_pipe('info', base) + +vm =3D iotests.VM().add_drive(top, 'backing.node-name=3Dbase') +vm.launch() + +log('Trying to remove persistent bitmap from r-o base node, should fail:') +vm.qmp_log('block-dirty-bitmap-remove', node=3D'base', name=3D'bitmap0') + +new_base_opts =3D { + 'node-name': 'base', + 'driver': 'qcow2', + 'file': { + 'driver': 'file', + 'filename': base + }, + 'read-only': False +} + +# Don't want to bother with filtering qmp_log for reopen command +result =3D vm.qmp('x-blockdev-reopen', **new_base_opts) +if result !=3D {'return': {}}: + log('Failed to reopen: ' + str(result)) + +log('Remove persistent bitmap from base node reopened to RW:') +vm.qmp_log('block-dirty-bitmap-remove', node=3D'base', name=3D'bitmap0') + +new_base_opts['read-only'] =3D True +result =3D vm.qmp('x-blockdev-reopen', **new_base_opts) +if result !=3D {'return': {}}: + log('Failed to reopen: ' + str(result)) + +vm.shutdown() + +if 'bitmaps' in qemu_img_pipe('info', base): + log('ERROR: Bitmap is still in the base image') diff --git a/tests/qemu-iotests/tests/remove-bitmap-from-backing.out b/test= s/qemu-iotests/tests/remove-bitmap-from-backing.out new file mode 100644 index 0000000000..c28af82c75 --- /dev/null +++ b/tests/qemu-iotests/tests/remove-bitmap-from-backing.out @@ -0,0 +1,6 @@ +Trying to remove persistent bitmap from r-o base node, should fail: +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "base"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap0' is readonly = and cannot be modified"}} +Remove persistent bitmap from base node reopened to RW: +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "base"}} +{"return": {}} --=20 2.30.2