From 86a9a680de92ee55250f302f3856109d165f7592 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 1 Aug 2012 08:45:33 +0200 Subject: [PATCH] use rpcinfo instead of Ping This works for NFS servers behind firewalls. --- PVE/Storage/NFSPlugin.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/PVE/Storage/NFSPlugin.pm b/PVE/Storage/NFSPlugin.pm index b20f8ab..9ba68a7 100644 --- a/PVE/Storage/NFSPlugin.pm +++ b/PVE/Storage/NFSPlugin.pm @@ -166,8 +166,18 @@ sub check_connection { my ($class, $storeid, $scfg) = @_; my $server = $scfg->{server}; - my $p = Net::Ping->new(); - return $p->ping($server, 2); + # test connection to portmapper + my $cmd = ['/usr/bin/rpcinfo', '-p', $server]; + + eval { + run_command($cmd, timeout => 2, outfunc => sub {}, errfunc => sub {}); + }; + if (my $err = $@) { + return 0; + } + + return 1; } + 1;