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.csa...@proxmox.com>
---
 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;
        });
+       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,
            };
 
-- 
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