mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-18 02:21:55 +00:00

this adds the typical section config crud API calls for USB and PCI resource mapping to /cluster/mapping/{TYPE} the only special thing that this series does is the list call for both has a special 'check-node' parameter that uses the 'proxyto_callback' to reroute the api call to the given node so that it can check the validity of the mapping for that node in the future when we e.g. broadcast the lspci output via pmxcfs we drop the proxyto_callback and directly use the info from pmxcfs (or we drop the parameter and always check all nodes) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
54 lines
934 B
Perl
54 lines
934 B
Perl
package PVE::API2::Cluster::Mapping;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use PVE::RESTHandler;
|
|
|
|
use PVE::API2::Cluster::Mapping::PCI;
|
|
use PVE::API2::Cluster::Mapping::USB;
|
|
|
|
use base qw(PVE::RESTHandler);
|
|
|
|
__PACKAGE__->register_method ({
|
|
subclass => "PVE::API2::Cluster::Mapping::PCI",
|
|
path => 'pci',
|
|
});
|
|
|
|
__PACKAGE__->register_method ({
|
|
subclass => "PVE::API2::Cluster::Mapping::USB",
|
|
path => 'usb',
|
|
});
|
|
|
|
__PACKAGE__->register_method ({
|
|
name => 'index',
|
|
path => '',
|
|
method => 'GET',
|
|
description => "List resource types.",
|
|
permissions => {
|
|
user => 'all',
|
|
},
|
|
parameters => {
|
|
additionalProperties => 0,
|
|
properties => {},
|
|
},
|
|
returns => {
|
|
type => 'array',
|
|
items => {
|
|
type => "object",
|
|
},
|
|
links => [ { rel => 'child', href => "{name}" } ],
|
|
},
|
|
code => sub {
|
|
my ($param) = @_;
|
|
|
|
my $result = [
|
|
{ name => 'pci' },
|
|
{ name => 'usb' },
|
|
];
|
|
|
|
return $result;
|
|
}});
|
|
|
|
1;
|