[pve-devel] [PATCH manager v6 1/5] mapping: pci: include mdev in config checks

Fiona Ebner f.ebner at proxmox.com
Fri Mar 7 14:00:53 CET 2025


Am 13.02.25 um 14:17 schrieb Dominik Csapak:
> by also providing the global config in assert_valid, and by also
> adding the mdev config in the 'toCheck' object in the gui
> 
> For the gui, we extract the mdev property from the global entry, and add
> it to the individual mapping entries, that way we can reuse the checking
> logic of the other properties.
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>

Reviewed-by: Fiona Ebner <f.ebner at proxmox.com>

> ---
> no changes in v6
>  PVE/API2/Cluster/Mapping/PCI.pm | 2 +-
>  www/manager6/dc/PCIMapView.js   | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/API2/Cluster/Mapping/PCI.pm b/PVE/API2/Cluster/Mapping/PCI.pm
> index 64462d25..f85623bb 100644
> --- a/PVE/API2/Cluster/Mapping/PCI.pm
> +++ b/PVE/API2/Cluster/Mapping/PCI.pm
> @@ -115,7 +115,7 @@ __PACKAGE__->register_method ({
>  			};
>  		    }
>  		    for my $mapping ($mappings->@*) {
> -			eval { PVE::Mapping::PCI::assert_valid($id, $mapping) };
> +			eval { PVE::Mapping::PCI::assert_valid($id, $mapping, $entry) };
>  			if (my $err = $@) {
>  			    push $entry->{checks}->@*, {
>  				severity => 'error',
> diff --git a/www/manager6/dc/PCIMapView.js b/www/manager6/dc/PCIMapView.js
> index 80fe3c0f..f9d43aa2 100644
> --- a/www/manager6/dc/PCIMapView.js
> +++ b/www/manager6/dc/PCIMapView.js
> @@ -20,10 +20,15 @@ Ext.define('PVE.dc.PCIMapView', {
>  	data.forEach((entry) => {
>  	    ids[entry.id] = entry;
>  	});

Nit: maybe worth a brief code comment here (e.g. what you already wrote
in the commit message).

> +	let mdev;
>  	me.getRootNode()?.cascade(function(rec) {
> +	    if (rec.data.type === 'entry') {
> +		mdev = rec.data.mdev ?? 0;
> +	    }
>  	    if (rec.data.node !== node || rec.data.type !== 'map') {
>  		return;
>  	    }
> +	    rec.data.mdev = mdev;
>  
>  	    let id = rec.data.path;
>  	    if (!id.match(/\.\d$/)) {
> @@ -44,6 +49,7 @@ Ext.define('PVE.dc.PCIMapView', {
>  	    let toCheck = {
>  		id: deviceId,
>  		'subsystem-id': subId,
> +		mdev: device.mdev ?? 0,
>  		iommugroup: device.iommugroup !== -1 ? device.iommugroup : undefined,
>  	    };
>  





More information about the pve-devel mailing list