fix: check connection for nfs v4 only server
the check_connection is done by querying the exports of the nfs server in question. With nfs v4 those exports aren't listed anymore since nfs v4 employs a pseudo-filesystem starting from root (/). rpcinfo allows to query the existence of an nfs v4 service. Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
d7fedf266a
commit
89b9ac961a
@ -160,8 +160,16 @@ sub check_connection {
|
||||
my ($class, $storeid, $scfg) = @_;
|
||||
|
||||
my $server = $scfg->{server};
|
||||
my $opts = $scfg->{options};
|
||||
|
||||
my $cmd = ['/sbin/showmount', '--no-headers', '--exports', $server];
|
||||
my $cmd;
|
||||
if (defined($opts) && $opts =~ /vers=4.*/) {
|
||||
# nfsv4 uses a pseudo-filesystem always beginning with /
|
||||
# no exports are listed
|
||||
$cmd = ['/usr/sbin/rpcinfo', '-t', $server, 'nfs', '4'];
|
||||
} else {
|
||||
$cmd = ['/sbin/showmount', '--no-headers', '--exports', $server];
|
||||
}
|
||||
|
||||
eval { run_command($cmd, timeout => 10, outfunc => sub {}, errfunc => sub {}) };
|
||||
if (my $err = $@) {
|
||||
|
||||
Reference in New Issue
Block a user