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. Reviewed-by: Christoph Heiss <c.he...@proxmox.com> Reviewed-by: Fiona Ebner <f.eb...@proxmox.com> Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- changes from v6: * added short comment about mdev checking PVE/API2/Cluster/Mapping/PCI.pm | 2 +- www/manager6/dc/PCIMapView.js | 8 ++++++++ 2 files changed, 9 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..2242f1a5 100644 --- a/www/manager6/dc/PCIMapView.js +++ b/www/manager6/dc/PCIMapView.js @@ -20,10 +20,17 @@ Ext.define('PVE.dc.PCIMapView', { data.forEach((entry) => { ids[entry.id] = entry; }); + // extract the mdev property from the global entry and insert to the individiual entries, + // so we can reuse the normal checking logic + 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 +51,7 @@ Ext.define('PVE.dc.PCIMapView', { let toCheck = { id: deviceId, 'subsystem-id': subId, + mdev: device.mdev ?? 0, iommugroup: device.iommugroup !== -1 ? device.iommugroup : undefined, }; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel