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 [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 83B8A1FF16F
	for <inbox@lore.proxmox.com>; Thu, 13 Feb 2025 10:31:25 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id C51602ED24;
	Thu, 13 Feb 2025 10:31:20 +0100 (CET)
Message-ID: <57490621-dbe3-4859-b653-f16b757c9b5d@proxmox.com>
Date: Thu, 13 Feb 2025 10:30:48 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
To: Christoph Heiss <c.heiss@proxmox.com>
References: <20250120145203.282363-1-d.csapak@proxmox.com>
 <20250120145203.282363-6-d.csapak@proxmox.com>
 <D7PMKAGM4YFP.KL69Q8B9ZZ9F@proxmox.com>
Content-Language: en-US
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <D7PMKAGM4YFP.KL69Q8B9ZZ9F@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.021 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
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [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>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On 2/11/25 13:45, Christoph Heiss wrote:
> On Mon Jan 20, 2025 at 3:51 PM CET, Dominik Csapak wrote:
> [..]
>> +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();
> 
> Nit: Maybe move this line into get_current_node_mapping() too, much like
> is done in the previous patch for PVE::QemuServer::USB? Would be nice
> from a consistency point-of-view.
> 

just note, this would not have worked, because I needed the $config outside of that function

but aside: i'll leave the 'find_on_current_node' code in guest-common, since we don't really
gain anything by moving that here and it makes more trouble with patch ordering and
depends/breaks cycle...

>> +	my $devices = get_current_node_mapping($config, $mapping);



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel