[pve-devel] [PATCH qemu-server v5 02/11] pci: mapping: move implementation of find_on_current_node here

Christoph Heiss c.heiss at proxmox.com
Tue Feb 11 13:45:12 CET 2025


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.

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




More information about the pve-devel mailing list