From nobody Sat Nov 23 16:48:14 2024 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=1731603513; cv=none; d=zohomail.com; s=zohoarc; b=EOH3sEZzAhKXI4tRh5Qx162LX3146TCbO/vrl3oldiTwJPY6fkGJ2pKooJytVd4fcbhnR/kCQS5oCee6FOtKQFMvIFNMa7c2cHz1buitvhUJZL4edIqtxzk/jTctDk/KCyx+x3kn9wLIaBtpco4ufPCP8yYY6ENbC6CZS4Hy0xo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603513; 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=8zHUJjMb2uKWrzxqyz9373vo6wMvYR2z3/aNBRu9PZM=; b=WxTpwrNuFHjLZ5AKQEr3ZxDlmbGuIJbnPfptGpOIeAwUMwGc3maJlMoAljUrJPPtHj75vjA4VDEWvMEt3M0wBoIZb+HjhSDizcAA4U8McWd1x/8HsQql6ow4Mz2Q0uGm5byRju0bhSZx2TQXRlicW5zEaLSH6kWwPO0B3XsAEWI= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731603513662275.2616080305779; Thu, 14 Nov 2024 08:58:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9h-0008PL-Tg; Thu, 14 Nov 2024 11:57:18 -0500 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 1tBd9c-0008OC-Tv for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBd9a-0002a0-OC for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:12 -0500 Received: from mx-prod-mc-03.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-479-IwVukOhUPBWe1PDwpl-TQA-1; Thu, 14 Nov 2024 11:57:06 -0500 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 84F641955F3E; Thu, 14 Nov 2024 16:57:05 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8556C1955F43; Thu, 14 Nov 2024 16:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603429; 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=8zHUJjMb2uKWrzxqyz9373vo6wMvYR2z3/aNBRu9PZM=; b=jAaHY0mJ3WGB5IYlf3s/XyU1BtesnTMtjZ/6/DCHDSogS88+3aJh1RSsWrqXTJ/E1tFQWv dks/CichbSnK51I1RnUjnZDQ++Q0KVygHGtCd1qxh/NjRpGnWtVf1IfPcbYbN0dX1Omm54 xo83H2LBHMQgL2ELUh0rGC12vFrpf+o= X-MC-Unique: IwVukOhUPBWe1PDwpl-TQA-1 X-Mimecast-MFC-AGG-ID: IwVukOhUPBWe1PDwpl-TQA From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 1/8] migration: Check current_migration in migration_is_running() Date: Thu, 14 Nov 2024 17:56:50 +0100 Message-ID: <20241114165657.254256-2-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H2=-0.69, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 1731603515331116600 Content-Type: text/plain; charset="utf-8" From: Peter Xu Report shows that commit 34a8892dec broke iotest 055: https://lore.kernel.org/r/b8806360-a2b6-4608-83a3-db67e264c733@linaro.org When replacing migration_is_idle() with "!migration_is_running()", it was overlooked that the idle helper also checks for current_migration being available first. The check would be there if the whole series was applied, but since the last patches in the previous series rely on some other patches to land first, we need to recover the behavior of migration_is_idle() first before that whole set will be merged. I left migration_is_active / migration_is_device alone, as I don't think it's possible for them to hit his case (current_migration not initialized). Also they're prone to removal soon from VFIO side. Cc: Fabiano Rosas Cc: Peter Maydell Fixes: 34a8892dec ("migration: Drop migration_is_idle()") Reported-by: Pierrick Bouvier Tested-by: Pierrick Bouvier Signed-off-by: Peter Xu Message-ID: <20241105182725.2393425-1-peterx@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- migration/migration.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index aedf7f0751..8c5bd0a75c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1117,6 +1117,10 @@ bool migration_is_running(void) { MigrationState *s =3D current_migration; =20 + if (!s) { + return false; + } + switch (s->state) { case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603540; cv=none; d=zohomail.com; s=zohoarc; b=BAhl7HW4d1zCIRgR75HscQLVZATEW7zq5AlM1djM+fMFHyx0VVBZJvuz9psR5VHaqCvaPwlBbu3xT9ZeFLnZwlSExpvwQzc7hQm4lw17XVw2VX6bI81p4pnZ5lF+Di2eXdn3vUlXPv0OZE6F5xb1/v+ahGCZ/NQAZlD+yWNTrU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603540; 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=ZIMNnOydHnArrL0aAQPB6i8307JCVgtIWZgz17oGRBM=; b=lCNNwQq7/Td04fYnrQ4p0D9p2xQDcwTqNK3A9FebbMNSK7Q+0lhRGLCokAPzZXBFA2InGDUORhMj2texQm8JvWC3NNF8QEwNgoAQVnCc5/gXqPWT9rDS/fsDOPl7AYpKMcDySjAHlpY8e6YIUeONVwm9bFkgBkHE6LYBPnxXTyg= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731603540785295.57849250000265; Thu, 14 Nov 2024 08:59:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9x-000066-3p; Thu, 14 Nov 2024 11:57:33 -0500 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 1tBd9e-0008Ou-Qp for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:15 -0500 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 1tBd9c-0002a5-Kv for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:13 -0500 Received: from mx-prod-mc-05.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-252-QDYARnvIP_2w6O60FkON_w-1; Thu, 14 Nov 2024 11:57:08 -0500 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BF4EC1955F42; Thu, 14 Nov 2024 16:57:07 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EBF3C1955F43; Thu, 14 Nov 2024 16:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603430; 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=ZIMNnOydHnArrL0aAQPB6i8307JCVgtIWZgz17oGRBM=; b=W9v1PRomOstwlf2Bu/suaefRrKj3j2u1y6gEISqehXzvZ/z37qm92Mcm0q1CPAOnEnRX4d 9jT35yQYSZyx5MtCZ+gbEukRust9GTsj1JnQ94f1/2kD8EOFfRncQH9bt8K8C2E8vQ+yQS Xr34NAsB95voH5fcrJ8juPLclIpruFU= X-MC-Unique: QDYARnvIP_2w6O60FkON_w-1 X-Mimecast-MFC-AGG-ID: QDYARnvIP_2w6O60FkON_w From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 2/8] parallels: fix possible int overflow Date: Thu, 14 Nov 2024 17:56:51 +0100 Message-ID: <20241114165657.254256-3-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.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: 1731603541338116600 Content-Type: text/plain; charset="utf-8" From: Dmitry Frolov The sum "cluster_index + count" may overflow uint32_t. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov Message-ID: <20241106080521.219255-2-frolov@swemel.ru> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/parallels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 9205a0864f..071b6dcaf8 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -184,11 +184,11 @@ static int mark_used(BlockDriverState *bs, unsigned l= ong *bitmap, BDRVParallelsState *s =3D bs->opaque; uint32_t cluster_index =3D host_cluster_index(s, off); unsigned long next_used; - if (cluster_index + count > bitmap_size) { + if ((uint64_t)cluster_index + count > bitmap_size) { return -E2BIG; } next_used =3D find_next_bit(bitmap, bitmap_size, cluster_index); - if (next_used < cluster_index + count) { + if (next_used < (uint64_t)cluster_index + count) { return -EBUSY; } bitmap_set(bitmap, cluster_index, count); --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603530; cv=none; d=zohomail.com; s=zohoarc; b=R9NdxygWrYGuTStVV6KTMXpvWZtM4t81WtlRF0jI1Oc0RJ/KmL7L6mt88FdD0cJlcST6uP0A67emWHWAXUfFPhhTnjBng86E+C35wMcT9wqNO8+mDkDloVVMpjoUC7wYaU2EPqGhv3KcVMa0wkS8yIMxShGb75y/dDW+V8LQoSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603530; 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=0MCWOSbSZn5yTxFcIeub6HHIJPD6bAYaJEsHCKHT+E0=; b=LVhIpFM0SQ8PFPUnrximitrfC4BAKWU9MnBGzA6jgBGJXugjTHb/pk8OM8S+QOXpYyZvcJ6vQfpcH39AyGoPQZ+aDEfYOSzQykKSsKm6wvYzZ3vMaOsPWfwWZvvnjzFeBG82gXoyvx6sDej+sbrQQ3sK62AzPSNRExAJN/Tlg84= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173160353096396.98404504215955; Thu, 14 Nov 2024 08:58:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9v-0008WH-2i; Thu, 14 Nov 2024 11:57:31 -0500 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 1tBd9k-0008QM-LM for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBd9g-0002as-9w for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:17 -0500 Received: from mx-prod-mc-03.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-295-rne5_HipOtW0mhPeO98Cuw-1; Thu, 14 Nov 2024 11:57:10 -0500 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D0881955F45; Thu, 14 Nov 2024 16:57:09 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 337981955F21; Thu, 14 Nov 2024 16:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603434; 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=0MCWOSbSZn5yTxFcIeub6HHIJPD6bAYaJEsHCKHT+E0=; b=VDjaNGOlHo2VhfyM1/+JumOy65l3/US609fW7MBrsLDxPMwFFUrdHw0frkJzls7ok++wMu F3eP4fUAvFbjPKG9q2j46+OQyPxiQgBo53X/VkMmQVZnVTrr5K9yFUd/kxlSC4IwO+IetA LJAI93IhtfLvEJJGoZrlZ5fz6M3ckms= X-MC-Unique: rne5_HipOtW0mhPeO98Cuw-1 X-Mimecast-MFC-AGG-ID: rne5_HipOtW0mhPeO98Cuw From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 3/8] iotests: reflow ReproducibleTestRunner arguments Date: Thu, 14 Nov 2024 17:56:52 +0100 Message-ID: <20241114165657.254256-4-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H2=-0.69, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.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: 1731603531296116600 Content-Type: text/plain; charset="utf-8" From: John Snow Trivial reflow to let the type names breathe. (I need to add a longer type name.) Signed-off-by: John Snow Message-ID: <20241101173700.965776-2-jsnow@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ea48af4a7b..673bbcd356 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1614,10 +1614,13 @@ def write(self, arg=3DNone): self.stream.write(arg) =20 class ReproducibleTestRunner(unittest.TextTestRunner): - def __init__(self, stream: Optional[TextIO] =3D None, - resultclass: Type[unittest.TestResult] =3D - ReproducibleTestResult, - **kwargs: Any) -> None: + def __init__( + self, + stream: Optional[TextIO] =3D None, + resultclass: Type[unittest.TestResult] =3D + ReproducibleTestResult, + **kwargs: Any + ) -> None: rstream =3D ReproducibleStreamWrapper(stream or sys.stdout) super().__init__(stream=3Drstream, # type: ignore descriptions=3DTrue, --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603501; cv=none; d=zohomail.com; s=zohoarc; b=oAvGzb3EhL30eoMOXf+JB3ohSOsmnPhnFdFSEiVOy+Yp8ywgovESgnIEOBgqDAjnHK1ituWeWtDvv7p9iXkwdpiT3/LZad3yH9mUrt14wxBT2m38FJQvW85KBVUrtQYxveahNo/M9XJWHViEYEgP7Rurkr4AAq8OWnZEw8X/ZB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603501; 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=YR7ZzIhbUx9KkC/8k3C7ELIpsigvWFkb0oTl8st8S/w=; b=isebJxMHYp9Oz4V4Ksj7+5lyQgj3h9SJq0fxC/vTyq7DOh7dN6WDKc2ujVkFBrYWnNFPaamfxDAK9G+mwCh2R3c6J+G4yvOTHrXB05WD2bOlFE0pAHGFeP7IuSwMPJT6LAKu2yEijdhDrV0wmxWjwXDQCyTekBATcsiLhrmmg9A= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731603501692959.767436281949; Thu, 14 Nov 2024 08:58:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9k-0008QN-Mu; Thu, 14 Nov 2024 11:57:20 -0500 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 1tBd9g-0008PK-OU for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:17 -0500 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 1tBd9e-0002ak-JT for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:15 -0500 Received: from mx-prod-mc-02.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-78-NkpGvSyPNAWudGgHlrEt8Q-1; Thu, 14 Nov 2024 11:57:12 -0500 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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0B49A19540F1; Thu, 14 Nov 2024 16:57:11 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D47611955F43; Thu, 14 Nov 2024 16:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603433; 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=YR7ZzIhbUx9KkC/8k3C7ELIpsigvWFkb0oTl8st8S/w=; b=JuOjR//9GMlF3fqaGBq9AMuNRaPfcRI9CnQDakFUeNwkonq8cgH2G+qJopRtRhfDIaTLvV ETT12jOpQdApOa70Ts0FsnpU31nrqlM/J55u+GUwAgXebCfmRWEonDWcMKbsZCUBQHT0K1 6WWKinRflrl2HM3tuwRoEhOOf2BqMV0= X-MC-Unique: NkpGvSyPNAWudGgHlrEt8Q-1 X-Mimecast-MFC-AGG-ID: NkpGvSyPNAWudGgHlrEt8Q From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 4/8] iotests: correct resultclass type in ReproducibleTestRunner Date: Thu, 14 Nov 2024 17:56:53 +0100 Message-ID: <20241114165657.254256-5-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 1731603503230116600 Content-Type: text/plain; charset="utf-8" From: John Snow I have a vague memory that I suggested this base class to Vladimir and said "Maybe someday it will break, and I'll just fix it then." Guess that's today. Fixes various mypy errors in the "make check-tox" python test for at least Python3.8; seemingly requires a fairly modern mypy and/or Python base version to trigger. Signed-off-by: John Snow Message-ID: <20241101173700.965776-3-jsnow@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 673bbcd356..19817c7353 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1617,7 +1617,7 @@ class ReproducibleTestRunner(unittest.TextTestRunner): def __init__( self, stream: Optional[TextIO] =3D None, - resultclass: Type[unittest.TestResult] =3D + resultclass: Type[unittest.TextTestResult] =3D ReproducibleTestResult, **kwargs: Any ) -> None: --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603529; cv=none; d=zohomail.com; s=zohoarc; b=bLVKGomsKoEvKSYPWW2WLm8U19N3/KDGhrsvwjMinypkBG68Ra7YsxaHtHQWGy1T2lcRUOyLo/oC2mWGbs4j7gwyqqY1mfW+4jXCP0OpeVnrdH7Ghe/kmEdF57TgqefaO7UUrU9tt1c3Cr6ZwPKjQcqev4ED8YiFTvXh/TYX68g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603529; 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=PA544ebOcakPFC3z9NuydEbkGdh39B4Q/lJdIbCHIYE=; b=f4CV0QY3i5oFPl/imSa9IYndRipQ2reHjPGvkbKpqqx6iK7ah4CEA89EMe9y3ETbF5wPNv7nHr9rFRHcf7K2F3JO8VO8CNRzRBbIkv63t0BeuTC5ielcASRltZN4C+/QTIbInFeSBIYQQ1oYfxYm/c+STxqeBZgK+GjnuylNxYU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731603529979745.3405188625175; Thu, 14 Nov 2024 08:58:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9o-0008Sz-Dk; Thu, 14 Nov 2024 11:57:24 -0500 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 1tBd9k-0008QP-M7 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:20 -0500 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 1tBd9g-0002bH-IB for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:19 -0500 Received: from mx-prod-mc-05.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-178-IFmEHiDXNGSObIv1SqJW2g-1; Thu, 14 Nov 2024 11:57:14 -0500 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 81B7A1956095; Thu, 14 Nov 2024 16:57:13 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DC1581955F43; Thu, 14 Nov 2024 16:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603436; 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=PA544ebOcakPFC3z9NuydEbkGdh39B4Q/lJdIbCHIYE=; b=LnDvUQwZ1EwFsAB7jcxTjgkW7eu7++JfrtXEeFAd85sDWumAE4c/psuf3SsKhwwjOet2yU xQjoIjBJ5W7GGtWq6oApCw0oTJV04d8ZnK90Bb2pEsbHLd6eC9PyHzO0649dsmNPBk179I t97qFuvDQ1wMo34LCdyJG/VQdI0z5Hk= X-MC-Unique: IFmEHiDXNGSObIv1SqJW2g-1 X-Mimecast-MFC-AGG-ID: IFmEHiDXNGSObIv1SqJW2g From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 5/8] python: disable too-many-positional-arguments warning Date: Thu, 14 Nov 2024 17:56:54 +0100 Message-ID: <20241114165657.254256-6-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 1731603531297116600 Content-Type: text/plain; charset="utf-8" From: John Snow Newest versions of pylint complain about specifically positional arguments in addition to too many in general. We already disable the general case, so silence this new warning too. Signed-off-by: John Snow Message-ID: <20241101173700.965776-4-jsnow@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- python/setup.cfg | 1 + tests/qemu-iotests/pylintrc | 1 + 2 files changed, 2 insertions(+) diff --git a/python/setup.cfg b/python/setup.cfg index 3b4e2cc550..cf5af7e664 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -142,6 +142,7 @@ ignore_missing_imports =3D True disable=3Dconsider-using-f-string, consider-using-with, too-many-arguments, + too-many-positional-arguments, too-many-function-args, # mypy handles this with less false posit= ives. too-many-instance-attributes, no-member, # mypy also handles this better. diff --git a/tests/qemu-iotests/pylintrc b/tests/qemu-iotests/pylintrc index 05b75ee59b..c5f4833e45 100644 --- a/tests/qemu-iotests/pylintrc +++ b/tests/qemu-iotests/pylintrc @@ -13,6 +13,7 @@ disable=3Dinvalid-name, no-else-return, too-few-public-methods, too-many-arguments, + too-many-positional-arguments, too-many-branches, too-many-lines, too-many-locals, --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603523; cv=none; d=zohomail.com; s=zohoarc; b=Lo8t382FaqADyKixhauQ+KJ4vRqhUebAOCP7LjEB7s8O9X4pWNAm8Fd4FBabXKjsfP1HCzVG5Bf/X9ZzTCGZVLEUoLdArSrold0Xv21FCH+jkD7AWgUCq5b+kNx7po8aVhjSkCe4mVj3yNJM3lkE0qF9X6JIEMVSlAnU6wYYp/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603523; 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=9P75sNr2f7388ubKnzuEESBswju/QLScY/HhvuOW+Mw=; b=N0+Nhk4y55+zHiAkXU7GUuU9s4iBQuyRoMIBWytUkXgI2oJLnX/TkBWr26vNbuzyf7vNx7RX9zOjhD/W5b9RZEl0yUmu1WpJ8E8n9Of9ZZQl/wZFxE61bogGL5vTUToSZbJvS7MhHN/rzpPl1AfIR6V+Y2BVJ0tOBzf/+KtGe6U= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731603523752957.5727570022245; Thu, 14 Nov 2024 08:58:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9y-0000Ao-F7; Thu, 14 Nov 2024 11:57:34 -0500 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 1tBd9m-0008RO-Hc for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:22 -0500 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 1tBd9k-0002bs-D2 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:21 -0500 Received: from mx-prod-mc-01.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-590-f30jzMZBO_enKjfR8VVTbw-1; Thu, 14 Nov 2024 11:57:16 -0500 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1EB791954B22; Thu, 14 Nov 2024 16:57:15 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E81A71955F43; Thu, 14 Nov 2024 16:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603439; 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=9P75sNr2f7388ubKnzuEESBswju/QLScY/HhvuOW+Mw=; b=WEaYH1vr4wsGXNKD5tdn+GQfEy4f/ZQ9xPJM/7nGHgUpG7w3SannPjeHmFUY1fkFZLZgJR qeeIq0oiyfYusJPBV3ruObMI6H+agOfJSSPr6muvbo2Yz8bl7WgXVt7g3TTteDzyYDxP4H LRqy4JARcLHX/9y98vAcs+0JfTiqZyQ= X-MC-Unique: f30jzMZBO_enKjfR8VVTbw-1 X-Mimecast-MFC-AGG-ID: f30jzMZBO_enKjfR8VVTbw From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 6/8] python: silence pylint raising-non-exception error Date: Thu, 14 Nov 2024 17:56:55 +0100 Message-ID: <20241114165657.254256-7-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.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: 1731603525310116600 Content-Type: text/plain; charset="utf-8" From: John Snow As of (at least) pylint 3.3.1, this code trips pylint up into believing we are raising something other than an Exception. We are not: the first two values may indeed be "None", but the last and final value must by definition be a SystemExit exception. Signed-off-by: John Snow Message-ID: <20241101173700.965776-5-jsnow@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- python/scripts/mkvenv.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/scripts/mkvenv.py b/python/scripts/mkvenv.py index f2526af0a0..8ac5b0b2a0 100644 --- a/python/scripts/mkvenv.py +++ b/python/scripts/mkvenv.py @@ -379,6 +379,9 @@ def make_venv( # pylint: disable=3Dtoo-many-arguments try: builder.create(str(env_dir)) except SystemExit as exc: + # pylint 3.3 bug: + # pylint: disable=3Draising-non-exception, raise-missing-from + # Some versions of the venv module raise SystemExit; *nasty*! # We want the exception that prompted it. It might be a subpro= cess # error that has output we *really* want to see. --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603580; cv=none; d=zohomail.com; s=zohoarc; b=WL6SUlV//HWt50SXQZqngAEn14lQmKJkBw2V2JTN0d9M2AUqv8ZRv9gAhdrwJ1I3KhxcjxsU1u7D5dnXii60FWFBaKFXNW0Km0JZyTjZq8/5bPYisnv1irzj2G195uUbFeH9BUXVMjw+ZYsrIdTrYpzMCSIgMNAAH2rdRh4MDaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603580; h=Content-Type: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=GLF0n6qglRIqtUkQqyx7RdSXVKBg4tQ932ju2zdvhJU=; b=V8JwI7PXovVVY1wMNqo/N/bU4X+2N5NNwSKuIR1Mt1lF3j11ClfIgmaHpqRjUmdu3jG3bQ5eO56bXzGvt+LBSYdld9Fzu2EkGjI+HLLl39wk6n4rXSwyic2KEt5TufcWpGWdG3RUR9ZP+04v46uOb96Sul0Wi9JI17gm+UgoRhM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731603580888171.73194640445251; Thu, 14 Nov 2024 08:59:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBd9x-00009R-Vn; Thu, 14 Nov 2024 11:57:34 -0500 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 1tBd9n-0008T3-TX for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:24 -0500 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 1tBd9m-0002c1-3W for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:23 -0500 Received: from mx-prod-mc-05.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-606-TbRcXxjuM52LUMlLjUmddg-1; Thu, 14 Nov 2024 11:57:18 -0500 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2601A1956083; Thu, 14 Nov 2024 16:57:17 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 866611955F21; Thu, 14 Nov 2024 16:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603440; 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=GLF0n6qglRIqtUkQqyx7RdSXVKBg4tQ932ju2zdvhJU=; b=bR3qmOCYv5xGfYY027wZbRJCJbxaTU0Wum0zq1b6VLDh1D5IhH/rbeoJKb50APjnOgFfC9 U8KOeoSAHU1Wq3BZ7zoBimx1MTXzS/8TcCEOdBuJtmBX0MZVmCzOlsT3P5wGrCNvwllJEH osycUlXDIH5Jq12i+Xp5y3mOzd0pXEE= X-MC-Unique: TbRcXxjuM52LUMlLjUmddg-1 X-Mimecast-MFC-AGG-ID: TbRcXxjuM52LUMlLjUmddg From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 7/8] qdev-monitor: avoid QemuOpts in QMP device_add Date: Thu, 14 Nov 2024 17:56:56 +0100 Message-ID: <20241114165657.254256-8-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.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: 1731603582360116600 From: Stefan Hajnoczi The QMP device_add monitor command converts the QDict arguments to QemuOpts and then back again to QDict. This process only supports scalar types. Device properties like virtio-blk-pci's iothread-vq-mapping (an array of objects) are silently dropped by qemu_opts_from_qdict() during the QemuOpts conversion even though QAPI is capable of validating them. As a result, hotplugging virtio-blk-pci devices with the iothread-vq-mapping property does not work as expected (the property is ignored). Get rid of the QemuOpts conversion in qmp_device_add() and call qdev_device_add_from_qdict() with from_json=3Dtrue. Using the QMP command's QDict arguments directly allows non-scalar properties. The HMP is also adjusted since qmp_device_add()'s now expects properly typed JSON arguments and cannot be used from HMP anymore. Move the code that was previously in qmp_device_add() (with QemuOpts conversion and from_json=3Dfalse) into hmp_device_add() so that its behavior is unchanged. This patch changes the behavior of QMP device_add but not HMP device_add. QMP clients that sent incorrectly typed device_add QMP commands no longer work. This is a breaking change but clients should be using the correct types already. See the netdev_add QAPIfication in commit db2a380c8457 for similar reasoning and object-add in commit 9151e59a8b6e. Unlike those commits, we continue to rely on 'gen': false for the time being. Markus helped me figure this out and even provided a draft patch. The code ended up very close to what he suggested. Suggested-by: Markus Armbruster Cc: Daniel P. Berrang=C3=A9 Signed-off-by: Stefan Hajnoczi Message-ID: <20240827192751.948633-2-stefanha@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- system/qdev-monitor.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 4c09b38ffb..03ae610649 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -856,18 +856,9 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict) =20 void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) { - QemuOpts *opts; DeviceState *dev; =20 - opts =3D qemu_opts_from_qdict(qemu_find_opts("device"), qdict, errp); - if (!opts) { - return; - } - if (!monitor_cur_is_qmp() && qdev_device_help(opts)) { - qemu_opts_del(opts); - return; - } - dev =3D qdev_device_add(opts, errp); + dev =3D qdev_device_add_from_qdict(qdict, true, errp); if (!dev) { /* * Drain all pending RCU callbacks. This is done because @@ -879,9 +870,6 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, E= rror **errp) * to the user */ drain_call_rcu(); - - qemu_opts_del(opts); - return; } object_unref(OBJECT(dev)); } @@ -1018,8 +1006,34 @@ void qmp_device_sync_config(const char *id, Error **= errp) void hmp_device_add(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; + QemuOpts *opts; + DeviceState *dev; =20 - qmp_device_add((QDict *)qdict, NULL, &err); + opts =3D qemu_opts_from_qdict(qemu_find_opts("device"), qdict, &err); + if (!opts) { + goto out; + } + if (qdev_device_help(opts)) { + qemu_opts_del(opts); + return; + } + dev =3D qdev_device_add(opts, &err); + if (!dev) { + /* + * Drain all pending RCU callbacks. This is done because + * some bus related operations can delay a device removal + * (in this case this can happen if device is added and then + * removed due to a configuration error) + * to a RCU callback, but user might expect that this interface + * will finish its job completely once qmp command returns result + * to the user + */ + drain_call_rcu(); + + qemu_opts_del(opts); + } + object_unref(dev); +out: hmp_handle_error(mon, err); } =20 --=20 2.47.0 From nobody Sat Nov 23 16:48:14 2024 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=1731603494; cv=none; d=zohomail.com; s=zohoarc; b=b7fuKMZkdZihcl3Q4bXsCbeYkcIgD2O6SMLxHKVy1deJMTCScT4Cnh7YpClerpBGZgbIkbH/WFRMTEtUxQmFxwI0rBT9gqcioUPSYON8IVReLAsihVv6J4D4vDIUGTMUgZSjqLUC555jQzyhUkoGLrHYsqeuL8DBMgKEs7Mx/I0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731603494; h=Content-Type: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=lM0oP4uYaxWqpfihOrRXw+G4JgNWK9m48rCXi/c32Qk=; b=nTbH9PQ4b+gX8UCW3XhdJpinfUJnNU+an5d6Z/q+vI1b5Tj54mi6MdajFv8wyJHJEUVViwEWrwdHMx8nFA+LjbCDq0UwKxbqqQhOx9iINkuU4YujhoF4/j8W/w9xS+yEehiyB4xn4z+fOchyY5ld8v4KpCg1Go40Ryt638o57Xw= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173160349460018.56439871744533; Thu, 14 Nov 2024 08:58:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBdA2-0000Cd-TI; Thu, 14 Nov 2024 11:57:39 -0500 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 1tBd9q-0008Vv-LP for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:28 -0500 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 1tBd9p-0002dC-5n for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:57:26 -0500 Received: from mx-prod-mc-01.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-634-q_aedtBNM3iGbOuD7hKhsQ-1; Thu, 14 Nov 2024 11:57:19 -0500 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B285B1955BFC; Thu, 14 Nov 2024 16:57:18 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.192.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8FFC51955F43; Thu, 14 Nov 2024 16:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731603444; 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=lM0oP4uYaxWqpfihOrRXw+G4JgNWK9m48rCXi/c32Qk=; b=TL/YTw/wtK+KCxBqOsgwXmVOP3v6GRRgPQpaXKypQXaIN+if++YP3MDFkbc5br/6gi+bos z9dSnM2p/l1vsIZ7ts/Xh07HnNM/asxqxdcYmsiCmXyVSqqneqTRe7nBeKw5R4TWWUiqLP R+8OF5MrOAZeYt+eTJPH0awcU5vv2vE= X-MC-Unique: q_aedtBNM3iGbOuD7hKhsQ-1 X-Mimecast-MFC-AGG-ID: q_aedtBNM3iGbOuD7hKhsQ From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 8/8] vl: use qmp_device_add() in qemu_create_cli_devices() Date: Thu, 14 Nov 2024 17:56:57 +0100 Message-ID: <20241114165657.254256-9-kwolf@redhat.com> In-Reply-To: <20241114165657.254256-1-kwolf@redhat.com> References: <20241114165657.254256-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.122, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 1731603497079116600 From: Stefan Hajnoczi qemu_create_cli_devices() should use qmp_device_add() to match the behavior of the QMP monitor. A comment explained that libvirt changes implementing strict CLI syntax were needed. Peter Krempa has confirmed that modern libvirt uses the same JSON for -device (CLI) and device_add (QMP). Go ahead and use qmp_device_add(). Cc: Peter Krempa Reviewed-by: Markus Armbruster Signed-off-by: Stefan Hajnoczi Message-ID: <20240827192751.948633-3-stefanha@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- system/vl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/system/vl.c b/system/vl.c index d217b3d64d..e3f7d3a156 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2653,17 +2653,11 @@ static void qemu_create_cli_devices(void) qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, &error_fatal); QTAILQ_FOREACH(opt, &device_opts, next) { - DeviceState *dev; + QObject *ret_data =3D NULL; + loc_push_restore(&opt->loc); - /* - * TODO Eventually we should call qmp_device_add() here to make su= re it - * behaves the same, but QMP still has to accept incorrectly typed - * options until libvirt is fixed and we want to be strict on the = CLI - * from the start, so call qdev_device_add_from_qdict() directly f= or - * now. - */ - dev =3D qdev_device_add_from_qdict(opt->opts, true, &error_fatal); - object_unref(OBJECT(dev)); + qmp_device_add(opt->opts, &ret_data, &error_fatal); + assert(ret_data =3D=3D NULL); /* error_fatal aborts */ loc_pop(&opt->loc); } rom_reset_order_override(); --=20 2.47.0