but that lives int he 'global' part of the mapping config, not in a
specific mapping. To check that, add it to the $configured_props from
there.

this requires all call sites to be adapted otherwise the check will
always fail for devices that are capable of mediated devices

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
changes from v4:
* rename $cfg to $cluster_mapping_cfg

 src/PVE/Mapping/PCI.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Mapping/PCI.pm b/src/PVE/Mapping/PCI.pm
index aa56496..cdd73d9 100644
--- a/src/PVE/Mapping/PCI.pm
+++ b/src/PVE/Mapping/PCI.pm
@@ -131,7 +131,7 @@ sub options {
 
 # checks if the given config is valid for the current node
 sub assert_valid {
-    my ($name, $mapping) = @_;
+    my ($name, $mapping, $cluster_mapping_cfg) = @_;
 
     my @paths = split(';', $mapping->{path} // '');
 
@@ -161,6 +161,12 @@ sub assert_valid {
 
        my $configured_props = { $mapping->%{qw(id iommugroup subsystem-id)} };
 
+       # check mdev from globabl mapping config, if that is given
+       if (defined($cluster_mapping_cfg)) {
+           $expected_props->{mdev} = $info->{mdev} ? 1 : 0;
+           $configured_props->{mdev} = $cluster_mapping_cfg->{mdev} ? 1 : 0;
+       }
+
        for my $prop (sort keys $expected_props->%*) {
            next if $prop eq 'iommugroup' && $idx > 0; # check iommu only on 
the first device
 
-- 
2.39.5



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

Reply via email to