From nobody Mon Apr 14 06:51:03 2025 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=1625836877; cv=none; d=zohomail.com; s=zohoarc; b=T/Cd01e7ZPEExXoSsefNONFAebkvs1sz82XkJUBrj+o1R3bxH2cGJ4DGdzsDt3dbGtJPmlK/Y5x9DoDNauBkMXkBx/cIALKdZ5w3mDUA6GkpYIu4cKZ+c3KrhVQ+WCy707s4xeXQ4O6ls3auvG7js0QeU7r3P2+zhX1JVLhJgJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625836877; 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=X6WEZJDFZx3axUsbd2JuM+VUAyPg4XCo6RKfx4Map2k=; b=e24x/CD4FCy1NXN7Y8r6J2PL0RB9/khsVf8NKdceDcG5+W1Xhs504JxqPzGhdkba7nZfKRnPQ24eT5PWrR/Aa7gZpED8MBsBrz401ZPmdbaGkYAQ4W26XTVrKMpE+c1EgKNQWcYiIvZf7Lxoe3Dda5HTAw9cCkYwcnn5sYavYuk= 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=<kwolf@redhat.com> (p=none dis=none) Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1625836877758489.6840327831518; Fri, 9 Jul 2021 06:21:17 -0700 (PDT) Received: from localhost ([::1]:59736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>) id 1m1qRQ-0004hd-K6 for importer@patchew.org; Fri, 09 Jul 2021 09:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <kwolf@redhat.com>) id 1m1pzU-0005kT-9u for qemu-devel@nongnu.org; Fri, 09 Jul 2021 08:52:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <kwolf@redhat.com>) id 1m1pzQ-0003se-CD for qemu-devel@nongnu.org; Fri, 09 Jul 2021 08:52:24 -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-545-6WBIt70lN7KAhxy8EgysIw-1; Fri, 09 Jul 2021 08:52:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 287B5188CBE1; Fri, 9 Jul 2021 12:52:17 +0000 (UTC) Received: from merkur.redhat.com (ovpn-113-203.ams2.redhat.com [10.36.113.203]) by smtp.corp.redhat.com (Postfix) with ESMTP id 329AD60843; Fri, 9 Jul 2021 12:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625835139; 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=X6WEZJDFZx3axUsbd2JuM+VUAyPg4XCo6RKfx4Map2k=; b=WKukOh6+VyuF9bplqXxA3lZtTQ0RKp8O2l5IcBbpW4KRMQzQlVI89nPZiVPFwCck+LT4Tr 9WbTdLNG2sj2v/JX1sKTihNgtSaVb9VG9jw7BdOIHvYIvTPx1lQlge+OfBDv2l1Q3LXa02 GXQ/k3dguboT590DdefCQDbE0djhgkc= X-MC-Unique: 6WBIt70lN7KAhxy8EgysIw-1 From: Kevin Wolf <kwolf@redhat.com> To: qemu-block@nongnu.org Subject: [PULL 27/28] iotests: Test reopening multiple devices at the same time Date: Fri, 9 Jul 2021 14:50:34 +0200 Message-Id: <20210709125035.191321-28-kwolf@redhat.com> In-Reply-To: <20210709125035.191321-1-kwolf@redhat.com> References: <20210709125035.191321-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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=216.205.24.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.45, 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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=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" <qemu-devel-bounces+importer=patchew.org@nongnu.org> X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1625836878646100005 Content-Type: text/plain; charset="utf-8" From: Alberto Garcia <berto@igalia.com> This test swaps the images used by two active block devices. This is now possible thanks to the new ability to run x-blockdev-reopen on multiple devices at the same time. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210708114709.206487-6-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- tests/qemu-iotests/245 | 47 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/245.out | 4 ++-- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index ca08955207..8bc8101e6d 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -649,6 +649,53 @@ class TestBlockdevReopen(iotests.QMPTestCase): '-c', 'read -P 0x40 0x40008 1', '-c', 'read -P 0x80 0x40010 1', h= d_path[0]) =20 + # Swap the disk images of two active block devices + def test_swap_files(self): + # Add hd0 and hd2 (none of them with backing files) + opts0 =3D hd_opts(0) + result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts= 0) + self.assert_qmp(result, 'return', {}) + + opts2 =3D hd_opts(2) + result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts= 2) + self.assert_qmp(result, 'return', {}) + + # Write different data to both block devices + self.run_qemu_io("hd0", "write -P 0xa0 0 1k") + self.run_qemu_io("hd2", "write -P 0xa2 0 1k") + + # Check that the data reads correctly + self.run_qemu_io("hd0", "read -P 0xa0 0 1k") + self.run_qemu_io("hd2", "read -P 0xa2 0 1k") + + # It's not possible to make a block device use an image that + # is already being used by the other device. + self.reopen(opts0, {'file': 'hd2-file'}, + "Permission conflict on node 'hd2-file': permissions " + "'write, resize' are both required by node 'hd2' (uses= " + "node 'hd2-file' as 'file' child) and unshared by node= " + "'hd0' (uses node 'hd2-file' as 'file' child).") + self.reopen(opts2, {'file': 'hd0-file'}, + "Permission conflict on node 'hd0-file': permissions " + "'write, resize' are both required by node 'hd0' (uses= " + "node 'hd0-file' as 'file' child) and unshared by node= " + "'hd2' (uses node 'hd0-file' as 'file' child).") + + # But we can swap the images if we reopen both devices at the + # same time + opts0['file'] =3D 'hd2-file' + opts2['file'] =3D 'hd0-file' + self.reopenMultiple([opts0, opts2]) + self.run_qemu_io("hd0", "read -P 0xa2 0 1k") + self.run_qemu_io("hd2", "read -P 0xa0 0 1k") + + # And we can of course come back to the original state + opts0['file'] =3D 'hd0-file' + opts2['file'] =3D 'hd2-file' + self.reopenMultiple([opts0, opts2]) + self.run_qemu_io("hd0", "read -P 0xa0 0 1k") + self.run_qemu_io("hd2", "read -P 0xa2 0 1k") + # Misc reopen tests with different block drivers @iotests.skip_if_unsupported(['quorum', 'throttle']) def test_misc_drivers(self): diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out index daf1e51922..4eced19294 100644 --- a/tests/qemu-iotests/245.out +++ b/tests/qemu-iotests/245.out @@ -17,8 +17,8 @@ read 1/1 bytes at offset 262152 read 1/1 bytes at offset 262160 1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 -.............. +............... ---------------------------------------------------------------------- -Ran 24 tests +Ran 25 tests =20 OK --=20 2.31.1