mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-15 23:05:03 +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>
58 lines
1.0 KiB
Perl
58 lines
1.0 KiB
Perl
package PVE::API2::Hardware;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use PVE::JSONSchema qw(get_standard_option);
|
|
use PVE::RESTHandler;
|
|
|
|
use PVE::API2::Hardware::PCI;
|
|
use PVE::API2::Hardware::USB;
|
|
|
|
use base qw(PVE::RESTHandler);
|
|
|
|
__PACKAGE__->register_method ({
|
|
subclass => "PVE::API2::Hardware::PCI",
|
|
path => 'pci',
|
|
});
|
|
|
|
__PACKAGE__->register_method ({
|
|
subclass => "PVE::API2::Hardware::USB",
|
|
path => 'usb',
|
|
});
|
|
|
|
__PACKAGE__->register_method ({
|
|
name => 'index',
|
|
path => '',
|
|
method => 'GET',
|
|
description => "Index of hardware types",
|
|
permissions => {
|
|
user => 'all',
|
|
},
|
|
parameters => {
|
|
additionalProperties => 0,
|
|
properties => {
|
|
node => get_standard_option('pve-node'),
|
|
},
|
|
},
|
|
returns => {
|
|
type => 'array',
|
|
items => {
|
|
type => "object",
|
|
properties => { type => { type => 'string'} },
|
|
},
|
|
links => [ { rel => 'child', href => "{type}" } ],
|
|
},
|
|
code => sub {
|
|
my ($param) = @_;
|
|
|
|
my $res = [
|
|
{ type => 'pci' },
|
|
{ type => 'usb' },
|
|
];
|
|
|
|
return $res;
|
|
}
|
|
});
|
|
|