[pve-devel] [PATCH manager] api: resource usb mapping: add missing proxyto_callback

Dominik Csapak d.csapak at proxmox.com
Wed Jun 21 12:05:09 CEST 2023


i have added it to the pci api call, but forgot to add it for usb
otherwise adding a mapped usb device only works on the node where the
gui is connected to

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Cluster/Mapping/USB.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PVE/API2/Cluster/Mapping/USB.pm b/PVE/API2/Cluster/Mapping/USB.pm
index 5495bce2..763d5c2b 100644
--- a/PVE/API2/Cluster/Mapping/USB.pm
+++ b/PVE/API2/Cluster/Mapping/USB.pm
@@ -15,6 +15,11 @@ __PACKAGE__->register_method ({
     name => 'index',
     path => '',
     method => 'GET',
+    # only proxy if we give the 'check-node' parameter
+    proxyto_callback => sub {
+	my ($rpcenv, $proxyto, $param) = @_;
+	return $param->{'check-node'} // 'localhost';
+    },
     description => "List USB Hardware Mappings",
     permissions => {
 	description => "Only lists entries where you have 'Mapping.Modify', 'Mapping.Use' or".
-- 
2.30.2






More information about the pve-devel mailing list