From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <d.csapak@proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4B97693F7A for <pve-devel@lists.proxmox.com>; Wed, 10 Apr 2024 13:04:04 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3036CCAC5 for <pve-devel@lists.proxmox.com>; Wed, 10 Apr 2024 13:04:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for <pve-devel@lists.proxmox.com>; Wed, 10 Apr 2024 13:04:03 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A208243C47 for <pve-devel@lists.proxmox.com>; Wed, 10 Apr 2024 13:04:02 +0200 (CEST) From: Dominik Csapak <d.csapak@proxmox.com> To: pve-devel@lists.proxmox.com Date: Wed, 10 Apr 2024 13:03:42 +0200 Message-Id: <20240410110401.2226201-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410110401.2226201-1-d.csapak@proxmox.com> References: <20240410110401.2226201-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH guest-common v2 3/5] mapping: pci: check the mdev configuration on the device too X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> X-List-Received-Date: Wed, 10 Apr 2024 11:04:04 -0000 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@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