From nobody Sat Nov 15 12:42:45 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1752608638; cv=none; d=zohomail.com; s=zohoarc; b=ZHmZ15as/gRlWelXzEPwNfQ3JnKw5Pvp05gUYkfo+387zd5n5rmDVBJkZneMS8qZgIJbN2Lz0zIgBMPNEWdG1r613IhIuWoJDdqRV/LHTKE3umyCJpIPwYHa0MSDS2U3KRzdtxLEOlRBBLCmLLtOeHvBVBedumRy5VfwQCwM64o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752608638; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jwgv47YLUvO/F34uGxNiYd+WQOW4mbMcciSwO93qLOg=; b=Lclx87VY1ljNNRPZPRcLcbNKoBv2TIQ2lKUlyk1ATGL3pH5UC8KVXnPmGY6nb90m1ISBKyNjdpoI3+fwEguV298Dwlmk+n5ysnmv+fa9NPvhAB2WbdHLB7WZa2ACoOHbrhkSnuSnDWs0Jx+TIWPqb06I7LellY6JZKN9733XSeU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752608638242178.7994735197251; Tue, 15 Jul 2025 12:43:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ublYl-0002sx-87; Tue, 15 Jul 2025 15:43:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ubkxK-0004Ad-Ea for qemu-devel@nongnu.org; Tue, 15 Jul 2025 15:04:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ubkxI-0001Qg-5m for qemu-devel@nongnu.org; Tue, 15 Jul 2025 15:04:46 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-TUJmSdTaPyOVv6sPNnbCEg-1; Tue, 15 Jul 2025 15:04:41 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E4C6B19560B3; Tue, 15 Jul 2025 19:04:40 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.34.84]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C62E197702B; Tue, 15 Jul 2025 19:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752606283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jwgv47YLUvO/F34uGxNiYd+WQOW4mbMcciSwO93qLOg=; b=EfpK9PG48idQ22HsV6SI/PA3KM/FOy9N1g6RZAqrEEO0JpxNypJc0uoXeirT1CZsAcoMFw XMJ2vOnJy/o8mTc/wg2WUnpc8QjSCZFyrxhvbaebPAWW2i3dkvfkZFSLDUJgm43rmdBZSe EPLiEna4yXTS42Rz/KQ2I4fQAnv4bvM= X-MC-Unique: TUJmSdTaPyOVv6sPNnbCEg-1 X-Mimecast-MFC-AGG-ID: TUJmSdTaPyOVv6sPNnbCEg_1752606281 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org Subject: [PULL 30/57] iotests: add test for changing the 'drive' property via 'qom-set' Date: Tue, 15 Jul 2025 21:03:03 +0200 Message-ID: <20250715190330.378764-31-kwolf@redhat.com> In-Reply-To: <20250715190330.378764-1-kwolf@redhat.com> References: <20250715190330.378764-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1752608639218116600 Content-Type: text/plain; charset="utf-8" From: Fiona Ebner Signed-off-by: Fiona Ebner Message-ID: <20250605100938.43133-1-f.ebner@proxmox.com> [kwolf: Fixed up pylint warnings flagged by 297] Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/qemu-iotests/tests/qom-set-drive | 75 ++++++++++++++++++++++ tests/qemu-iotests/tests/qom-set-drive.out | 11 ++++ 2 files changed, 86 insertions(+) create mode 100755 tests/qemu-iotests/tests/qom-set-drive create mode 100644 tests/qemu-iotests/tests/qom-set-drive.out diff --git a/tests/qemu-iotests/tests/qom-set-drive b/tests/qemu-iotests/te= sts/qom-set-drive new file mode 100755 index 0000000000..ec8ddac4fd --- /dev/null +++ b/tests/qemu-iotests/tests/qom-set-drive @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +# group: quick +# +# Test how changing the 'drive' property via 'qom-set' behaves. +# +# Copyright (C) Proxmox Server Solutions 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 os +import iotests +from iotests import imgfmt, log, qemu_img_create, QMPTestCase + +image_size =3D 1 * 1024 * 1024 +images =3D [os.path.join(iotests.test_dir, f'{i}.img') for i in range(0, 4= )] + +class TestQOMSetDrive(QMPTestCase): + def setUp(self) -> None: + for image in images: + qemu_img_create('-f', imgfmt, image, str(image_size)) + + self.vm =3D iotests.VM() + for i, image in enumerate(images): + self.vm.add_blockdev(self.vm.qmp_to_opts({ + 'driver': imgfmt, + 'node-name': f'node{i}', + 'file': { + 'driver': 'file', + 'filename': image, + } + })) + self.vm.add_object('iothread,id=3Diothread0') + self.vm.add_device('virtio-scsi,iothread=3Diothread0') + self.vm.add_device('scsi-hd,id=3Diot,drive=3Dnode0') + self.vm.add_device('virtio-scsi') + self.vm.add_device('scsi-hd,id=3Dno-iot,drive=3Dnode1') + self.vm.launch() + + def tearDown(self) -> None: + self.vm.shutdown() + for image in images: + os.remove(image) + + def test_qom_set_drive(self) -> None: + log(self.vm.qmp('qom-get', path=3D'/machine/peripheral/iot', + property=3D'drive')) + log(self.vm.qmp('qom-set', path=3D'/machine/peripheral/iot', + property=3D'drive', value=3D'node2')) + log(self.vm.qmp('qom-get', path=3D'/machine/peripheral/iot', + property=3D'drive')) + + log(self.vm.qmp('qom-get', path=3D'/machine/peripheral/no-iot', + property=3D'drive')) + log(self.vm.qmp('qom-set', path=3D'/machine/peripheral/no-iot', + property=3D'drive', value=3D'node3')) + log(self.vm.qmp('qom-get', path=3D'/machine/peripheral/no-iot', + property=3D'drive')) + +if __name__ =3D=3D '__main__': + iotests.activate_logging() + # LUKS would require special key-secret handling in add_blockdevs() + iotests.main(supported_fmts=3D['generic'], + unsupported_fmts=3D['luks']) diff --git a/tests/qemu-iotests/tests/qom-set-drive.out b/tests/qemu-iotest= s/tests/qom-set-drive.out new file mode 100644 index 0000000000..7fc243dca6 --- /dev/null +++ b/tests/qemu-iotests/tests/qom-set-drive.out @@ -0,0 +1,11 @@ +{"return": "node0"} +{"error": {"class": "GenericError", "desc": "Different aio context is not = supported for new node"}} +{"return": "node0"} +{"return": "node1"} +{"return": {}} +{"return": "node3"} +. +---------------------------------------------------------------------- +Ran 1 tests + +OK --=20 2.50.1