]>
git.proxmox.com Git - pve-storage.git/blob - PVE/API2/Storage/Scan.pm
1 package PVE
::API2
::Storage
::Scan
;
8 use PVE
::Storage
::LVMPlugin
;
9 use HTTP
::Status
qw(:constants);
10 use PVE
::JSONSchema
qw(get_standard_option);
14 use base
qw(PVE::RESTHandler);
16 __PACKAGE__-
>register_method ({
20 description
=> "Index of available scan methods",
25 additionalProperties
=> 0,
27 node
=> get_standard_option
('pve-node'),
34 properties
=> { method => { type
=> 'string'} },
36 links
=> [ { rel
=> 'child', href
=> "{method}" } ],
43 { method => 'iscsi' },
51 __PACKAGE__-
>register_method ({
55 description
=> "Scan remote NFS server.",
59 check
=> ['perm', '/storage', ['Datastore.Allocate']],
62 additionalProperties
=> 0,
64 node
=> get_standard_option
('pve-node'),
65 server
=> { type
=> 'string', format
=> 'pve-storage-server' },
73 path
=> { type
=> 'string'},
74 options
=> { type
=> 'string'},
81 my $server = $param->{server
};
82 my $res = PVE
::Storage
::scan_nfs
($server);
85 foreach my $k (keys %$res) {
86 push @$data, { path
=> $k, options
=> $res->{$k} };
91 __PACKAGE__-
>register_method ({
95 description
=> "Scan remote iSCSI server.",
99 check
=> ['perm', '/storage', ['Datastore.Allocate']],
102 additionalProperties
=> 0,
104 node
=> get_standard_option
('pve-node'),
105 portal
=> { type
=> 'string', format
=> 'pve-storage-portal-dns' },
113 target
=> { type
=> 'string'},
114 portal
=> { type
=> 'string'},
121 my $res = PVE
::Storage
::scan_iscsi
($param->{portal
});
124 foreach my $k (keys %$res) {
125 push @$data, { target
=> $k, portal
=> join(',', @{$res->{$k}}) };
131 __PACKAGE__-
>register_method ({
135 description
=> "List local LVM volume groups.",
139 check
=> ['perm', '/storage', ['Datastore.Allocate']],
142 additionalProperties
=> 0,
144 node
=> get_standard_option
('pve-node'),
152 vg
=> { type
=> 'string'},
159 my $res = PVE
::Storage
::LVMPlugin
::lvm_vgs
();
160 return PVE
::RESTHandler
::hash_to_array
($res, 'vg');
163 __PACKAGE__-
>register_method ({
167 description
=> "List local USB devices.",
171 check
=> ['perm', '/', ['Sys.Modify']],
174 additionalProperties
=> 0,
176 node
=> get_standard_option
('pve-node'),
184 busnum
=> { type
=> 'integer'},
185 devnum
=> { type
=> 'integer'},
186 port
=> { type
=> 'integer'},
187 usbpath
=> { type
=> 'string', optional
=> 1},
188 level
=> { type
=> 'integer'},
189 class => { type
=> 'integer'},
190 vendid
=> { type
=> 'string'},
191 prodid
=> { type
=> 'string'},
192 speed
=> { type
=> 'string'},
194 product
=> { type
=> 'string', optional
=> 1 },
195 serial
=> { type
=> 'string', optional
=> 1 },
196 manufacturer
=> { type
=> 'string', optional
=> 1 },
203 return PVE
::Storage
::scan_usb
();