this was the only user, and it's easy enough Signed-off-by: Dominik Csapak <d.csa...@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