From nobody Mon Sep 8 17:04:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756276944; cv=none; d=zohomail.com; s=zohoarc; b=nSXwNXr74XJgFA80KrUuNM57OqqFBqnoBqrxQaKtrpeKnq2oaAiXoI9Zq51/CHYoJsxZdAWAjsLw8ZrEKkiloMMfM/MxYoHMCjAazYnpG5joSgbrn2B83j1ZEtNt51BtrzlmM2v0XVxZk6v5Tw1r0iL5eQ4OjFV5MmesksuxUAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756276944; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=R8pwc9oEfm+31tfSP3dov7KcGkTt7wEKN0bazD9W9vU=; b=d2ZHdn/GvJUDYpmGGSFVzTEf4AkWjHva8l6jd07f0M6CaXcFv2qKE9hhLk5nC/AC5N8tCkhaeuDZr64crNy2YQGlYo8Nf97yaK4mhoySAXKXN5XogDa+7cVFdiTG1qTWK6ptB2M9/HVF8xhFvRN3+jrOXCsrjgv6GNboWOyKqkQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756276944488996.3839736476377; Tue, 26 Aug 2025 23:42:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9FF5043F40; Wed, 27 Aug 2025 02:42:23 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3BF81440D3; Wed, 27 Aug 2025 02:38:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 139EF43F37; Wed, 27 Aug 2025 02:38:15 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E4A1F43F34 for ; Wed, 27 Aug 2025 02:38:13 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-CWGGY4zAOxqXXw8uqvMjnQ-1; Wed, 27 Aug 2025 02:38:11 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5A2D91800446 for ; Wed, 27 Aug 2025 06:38:10 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.65.70]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E46E019560AB for ; Wed, 27 Aug 2025 06:38:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756276693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R8pwc9oEfm+31tfSP3dov7KcGkTt7wEKN0bazD9W9vU=; b=JRixZciBuQp0kNUgP6yDnHfcaMmH1WlkA3fMu8yzWAjhRwO6IaioLGtWogMhRlh5gMsmTz 8aqbqlfx+uCwx5Vd09aqfedUG776HTqhJPYmEbzl1/78EJo2u18wiYPVTXFbIFNqueJm8X XZ0xkHel4eAOeNiEPSXIRorVEvjq3+g= X-MC-Unique: CWGGY4zAOxqXXw8uqvMjnQ-1 X-Mimecast-MFC-AGG-ID: CWGGY4zAOxqXXw8uqvMjnQ_1756276690 To: devel@lists.libvirt.org Subject: [PATCH 2/3] conf: improve error message when a PCI controller can't be auto-added Date: Wed, 27 Aug 2025 02:38:06 -0400 Message-ID: <20250827063807.99334-3-laine@redhat.com> In-Reply-To: <20250827063807.99334-1-laine@redhat.com> References: <20250827063807.99334-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8SKuS3fsheIqduWWQR4St1sFPSirhldE9gR4pcUch-k_1756276690 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 46P6WV2SGYR6GFVDTZWPUYREHPQQBLFI X-Message-ID-Hash: 46P6WV2SGYR6GFVDTZWPUYREHPQQBLFI X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756276946796116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Log a slightly different message when the missing-but-required slot is conventional PCI vs PCIe. Also correct/improve the comments about why auto-add of a PCI controller isn't supported when we're trying to create a slot for various different pci controllers. Signed-off-by: Laine Stump --- src/conf/domain_addr.c | 37 +++++++++++++++---- .../pcie-root-port-too-many.x86_64-latest.err | 2 +- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 7d58e2222a..ef1b2bd69a 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -704,7 +704,7 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSet *addr= s, * and we can't automatically decide which numa node to * associate it with) * - * VIR_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT - we ndon't + * VIR_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT - we don't * support this, because it can only plug into an * upstream-port, and the upstream port might need a * root-port; supporting this extra layer needlessly @@ -717,20 +717,41 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSet *ad= drs, * devices on the host, and are also outside the scope of our * "automatic-bus-expansion". * - * VIR_PCI_CONNECT_TYPE_PCI_BRIDGE (when the root bus is - * pci-root) - see the comment above in the case that handles - * adding a slot for pci-bridge to a guest with pcie-root. + * VIR_PCI_CONNECT_TYPE_PCI_BRIDGE if the root bus is pci-root + * but there are no free slots already available to plug in a + * pci-bridge, then the battle is already lost - the only way + * to get another open slot would be to auto-add a pci-bridge + * device, but that's what we're already trying to do - by + * definition either we wouldn't get here in the first place, + * or it's already too late. + * + * Alternatively if the root bus *isn't* pci-root, then + * either the root bus is pcie-root (in which case the user + * should be using a pcie-to-pci-bridge instead), or there is + * no PCI supported *at all*, and in both of those cases we + * should fail. + * + * Additionally, we obviously can't auto-add any type of PCIe + * controller if the root bus is pci-root, or if there is no + * PCI supported at all. * */ int existingContModel =3D virDomainPCIControllerConnectTypeToModel= (flags); =20 if (existingContModel >=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("a PCI slot is needed to connect a PCI contro= ller model=3D'%1$s', but none is available, and it cannot be automatically = added"), - virDomainControllerModelPCITypeToString(existin= gContModel)); + if (existingContModel =3D=3D VIR_PCI_CONNECT_TYPE_PCI_EXPANDER= _BUS || + existingContModel =3D=3D VIR_PCI_CONNECT_TYPE_PCI_BRIDGE) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("a conventional PCI slot is needed to con= nect a PCI controller model=3D'%1$s', but none is available, and it cannot = be automatically added"), + virDomainControllerModelPCITypeToString(exi= stingContModel)); + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("a PCIe slot is needed to connect a PCI c= ontroller model=3D'%1$s', but none is available, and it cannot be automatic= ally added"), + virDomainControllerModelPCITypeToString(exi= stingContModel)); + } } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot automatically add a new PCI bus for a= device with connect flags %1$.2x"), + _("Cannot automatically add a new PCI bus for a= device with unrecognized connect flags %1$.2x"), flags); } return -1; diff --git a/tests/qemuxmlconfdata/pcie-root-port-too-many.x86_64-latest.er= r b/tests/qemuxmlconfdata/pcie-root-port-too-many.x86_64-latest.err index 9b24cfb7e0..e1d543a50a 100644 --- a/tests/qemuxmlconfdata/pcie-root-port-too-many.x86_64-latest.err +++ b/tests/qemuxmlconfdata/pcie-root-port-too-many.x86_64-latest.err @@ -1 +1 @@ -internal error: a PCI slot is needed to connect a PCI controller model=3D'= pcie-root-port', but none is available, and it cannot be automatically added +internal error: a PCIe slot is needed to connect a PCI controller model=3D= 'pcie-root-port', but none is available, and it cannot be automatically add= ed --=20 2.51.0