API: add scan method for glusterfs
This commit is contained in:
@ -42,6 +42,7 @@ __PACKAGE__->register_method ({
|
|||||||
{ method => 'lvm' },
|
{ method => 'lvm' },
|
||||||
{ method => 'iscsi' },
|
{ method => 'iscsi' },
|
||||||
{ method => 'nfs' },
|
{ method => 'nfs' },
|
||||||
|
{ method => 'glusterfs' },
|
||||||
{ method => 'usb' },
|
{ method => 'usb' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -88,6 +89,51 @@ __PACKAGE__->register_method ({
|
|||||||
return $data;
|
return $data;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
# Note: GlusterFS currently does not have an equivalent of showmount.
|
||||||
|
# As workaround, we simply use nfs showmount.
|
||||||
|
# see http://www.gluster.org/category/volumes/
|
||||||
|
|
||||||
|
__PACKAGE__->register_method ({
|
||||||
|
name => 'glusterfsscan',
|
||||||
|
path => 'glusterfs',
|
||||||
|
method => 'GET',
|
||||||
|
description => "Scan remote GlusterFS server.",
|
||||||
|
protected => 1,
|
||||||
|
proxyto => "node",
|
||||||
|
permissions => {
|
||||||
|
check => ['perm', '/storage', ['Datastore.Allocate']],
|
||||||
|
},
|
||||||
|
parameters => {
|
||||||
|
additionalProperties => 0,
|
||||||
|
properties => {
|
||||||
|
node => get_standard_option('pve-node'),
|
||||||
|
server => { type => 'string', format => 'pve-storage-server' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
returns => {
|
||||||
|
type => 'array',
|
||||||
|
items => {
|
||||||
|
type => "object",
|
||||||
|
properties => {
|
||||||
|
volname => { type => 'string'},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
code => sub {
|
||||||
|
my ($param) = @_;
|
||||||
|
|
||||||
|
my $server = $param->{server};
|
||||||
|
my $res = PVE::Storage::scan_nfs($server);
|
||||||
|
|
||||||
|
my $data = [];
|
||||||
|
foreach my $path (keys %$res) {
|
||||||
|
if ($path =~ m!^/([^\s/]+)$!) {
|
||||||
|
push @$data, { volname => $1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}});
|
||||||
|
|
||||||
__PACKAGE__->register_method ({
|
__PACKAGE__->register_method ({
|
||||||
name => 'iscsiscan',
|
name => 'iscsiscan',
|
||||||
path => 'iscsi',
|
path => 'iscsi',
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
libpve-storage-perl (3.0-10) unstable; urgency=low
|
libpve-storage-perl (3.0-10) unstable; urgency=low
|
||||||
|
|
||||||
* add Glusterfs Plugin
|
* add Glusterfs Plugin
|
||||||
|
|
||||||
|
* API: add scan method for glusterfs
|
||||||
|
|
||||||
-- Proxmox Support Team <support@proxmox.com> Tue, 13 Aug 2013 06:45:27 +0200
|
-- Proxmox Support Team <support@proxmox.com> Tue, 13 Aug 2013 06:45:27 +0200
|
||||||
|
|
||||||
|
|||||||
8
pvesm
8
pvesm
@ -143,6 +143,14 @@ my $cmddef = {
|
|||||||
printf "%-${maxlen}s %s\n", $rec->{path}, $rec->{options};
|
printf "%-${maxlen}s %s\n", $rec->{path}, $rec->{options};
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
glusterfsscan => [ "PVE::API2::Storage::Scan", 'glusterfsscan', ['server'],
|
||||||
|
{ node => $nodename }, sub {
|
||||||
|
my $res = shift;
|
||||||
|
|
||||||
|
foreach my $rec (@$res) {
|
||||||
|
printf "%s\n", $rec->{volname};
|
||||||
|
}
|
||||||
|
}],
|
||||||
iscsiscan => [ "PVE::API2::Storage::Scan", 'iscsiscan', ['server'],
|
iscsiscan => [ "PVE::API2::Storage::Scan", 'iscsiscan', ['server'],
|
||||||
{ node => $nodename }, sub {
|
{ node => $nodename }, sub {
|
||||||
my $res = shift;
|
my $res = shift;
|
||||||
|
|||||||
Reference in New Issue
Block a user