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