]> git.proxmox.com Git - pve-storage.git/blame - PVE/API2/Storage/Scan.pm
move Scan API calls from PVE/API2/Storage/Scan.pm to pvesm.pm
[pve-storage.git] / PVE / API2 / Storage / Scan.pm
CommitLineData
b6cf0a66
DM
1package PVE::API2::Storage::Scan;
2
3use strict;
4use warnings;
5
6use PVE::SafeSyslog;
7use PVE::Storage;
6d64e9e0 8use PVE::Storage::LVMPlugin;
b6cf0a66
DM
9use HTTP::Status qw(:constants);
10use PVE::JSONSchema qw(get_standard_option);
11
12use PVE::RESTHandler;
13
14use base qw(PVE::RESTHandler);
15
16__PACKAGE__->register_method ({
17 name => 'index',
18 path => '',
19 method => 'GET',
20 description => "Index of available scan methods",
5f642f73
DM
21 permissions => {
22 user => 'all',
23 },
b6cf0a66
DM
24 parameters => {
25 additionalProperties => 0,
26 properties => {
27 node => get_standard_option('pve-node'),
28 },
29 },
30 returns => {
31 type => 'array',
32 items => {
33 type => "object",
34 properties => { method => { type => 'string'} },
35 },
36 links => [ { rel => 'child', href => "{method}" } ],
37 },
38 code => sub {
39 my ($param) = @_;
40
41 my $res = [
42 { method => 'lvm' },
43 { method => 'iscsi' },
44 { method => 'nfs' },
3cf5e19e 45 { method => 'glusterfs' },
b6cf0a66 46 { method => 'usb' },
584d97f6 47 { method => 'zfs' },
b9cfb8ca 48 { method => 'cifs' },
b6cf0a66
DM
49 ];
50
51 return $res;
52 }});
53
b6cf0a66
DM
54__PACKAGE__->register_method ({
55 name => 'usbscan',
56 path => 'usb',
57 method => 'GET',
58 description => "List local USB devices.",
59 protected => 1,
60 proxyto => "node",
5f642f73
DM
61 permissions => {
62 check => ['perm', '/', ['Sys.Modify']],
63 },
b6cf0a66
DM
64 parameters => {
65 additionalProperties => 0,
66 properties => {
67 node => get_standard_option('pve-node'),
68 },
69 },
70 returns => {
71 type => 'array',
72 items => {
73 type => "object",
74 properties => {
75 busnum => { type => 'integer'},
76 devnum => { type => 'integer'},
77 port => { type => 'integer'},
78 usbpath => { type => 'string', optional => 1},
79 level => { type => 'integer'},
80 class => { type => 'integer'},
81 vendid => { type => 'string'},
82 prodid => { type => 'string'},
83 speed => { type => 'string'},
84
85 product => { type => 'string', optional => 1 },
86 serial => { type => 'string', optional => 1 },
87 manufacturer => { type => 'string', optional => 1 },
88 },
89 },
90 },
91 code => sub {
92 my ($param) = @_;
93
94 return PVE::Storage::scan_usb();
95 }});
96
971;