From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 352841FF16E for <inbox@lore.proxmox.com>; Mon, 20 Jan 2025 15:52:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C1B211DF6C; Mon, 20 Jan 2025 15:52:10 +0100 (CET) From: Dominik Csapak <d.csapak@proxmox.com> To: pve-devel@lists.proxmox.com Date: Mon, 20 Jan 2025 15:51:47 +0100 Message-Id: <20250120145203.282363-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250120145203.282363-1-d.csapak@proxmox.com> References: <20250120145203.282363-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.019 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server v5 02/11] pci: mapping: move implementation of find_on_current_node here X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> this was the only user, and it's easy enough Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- changes from v4: * factor out some code into it's own sub to keep parse_hostpci smaller (we need $config again later, so keep it outside the sub) PVE/QemuServer/PCI.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm index d758ae9d..d6655b76 100644 --- a/PVE/QemuServer/PCI.pm +++ b/PVE/QemuServer/PCI.pm @@ -3,6 +3,7 @@ package PVE::QemuServer::PCI; use warnings; use strict; +use PVE::INotify; use PVE::JSONSchema; use PVE::Mapping::PCI; use PVE::SysFSTools; @@ -388,6 +389,16 @@ sub print_pcie_root_port { return $res; } +my sub get_current_node_mapping { + my ($mapping_config, $mapping_name) = @_; + + my $node = PVE::INotify::nodename(); + my $devices = PVE::Mapping::PCI::get_node_mapping($mapping_config, $mapping_name, $node); + die "PCI device mapping not found for '$mapping_name'\n" if !$devices || !scalar($devices->@*); + + return $devices; +} + # returns the parsed pci config but parses the 'host' part into # a list if lists into the 'id' property like this: # @@ -429,8 +440,8 @@ sub parse_hostpci { if ($mapping) { # we have no ordinary pci id, must be a mapping - my $devices = PVE::Mapping::PCI::find_on_current_node($mapping); - die "PCI device mapping not found for '$mapping'\n" if !$devices || !scalar($devices->@*); + my $config = PVE::Mapping::PCI::config(); + my $devices = get_current_node_mapping($config, $mapping); for my $device ($devices->@*) { eval { PVE::Mapping::PCI::assert_valid($mapping, $device) }; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel