[pve-devel] [PATCH guest-common v2 3/5] mapping: pci: check the mdev configuration on the device too

Dominik Csapak d.csapak at proxmox.com
Wed Apr 10 13:03:42 CEST 2024


but that lives int he 'global' part of the mapping config, not in a
specific mapping. To check that, add a new (optional) parameter to assert_valid
that includes said global config.

by making that check optional, we don't break older users of that
function.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/Mapping/PCI.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Mapping/PCI.pm b/src/PVE/Mapping/PCI.pm
index fcf07c0..d8a5962 100644
--- a/src/PVE/Mapping/PCI.pm
+++ b/src/PVE/Mapping/PCI.pm
@@ -151,9 +151,9 @@ my sub check_properties {
 
 # checks if the given config is valid for the current node
 sub assert_valid {
-    my ($name, $cfg) = @_;
+    my ($name, $mapping, $cfg) = @_;
 
-    my @paths = split(';', $cfg->{path} // '');
+    my @paths = split(';', $mapping->{path} // '');
 
     my $idx = 0;
     for my $path (@paths) {
@@ -181,7 +181,9 @@ sub assert_valid {
 	    $correct_props->{'subsystem-id'} = "$info->{'subsystem_vendor'}:$info->{'subsystem_device'}";
 	}
 
-	check_properties($correct_props, $cfg, $path, $name);
+	check_properties($correct_props, $mapping, $path, $name);
+	# check mdev from globabl mapping config
+	check_properties({ mdev => $info->{mdev}, }, $cfg, $path, $name) if defined($cfg);
 
 	$idx++;
     }
-- 
2.39.2





More information about the pve-devel mailing list