From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Lamprecht <t.lamprecht@proxmox.com>
Subject: [pve-devel] [PATCH v2 storage] fix #3348: NFS: select correct transport to check for service
Date: Wed, 17 Mar 2021 13:49:42 +0100 [thread overview]
Message-ID: <20210317124942.14987-1-f.ebner@proxmox.com> (raw)
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
Changes from v1:
* use existing helper functions to determine the correct transport type
PVE/Storage/NFSPlugin.pm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/NFSPlugin.pm b/PVE/Storage/NFSPlugin.pm
index cb16864..39bf15a 100644
--- a/PVE/Storage/NFSPlugin.pm
+++ b/PVE/Storage/NFSPlugin.pm
@@ -5,6 +5,8 @@ use warnings;
use IO::File;
use Net::IP;
use File::Path;
+
+use PVE::Network;
use PVE::Tools qw(run_command);
use PVE::ProcFSTools;
use PVE::Storage::Plugin;
@@ -164,9 +166,16 @@ sub check_connection {
my $cmd;
if (defined($opts) && $opts =~ /vers=4.*/) {
+ my $ip = PVE::JSONSchema::pve_verify_ip($server, 1);
+ if (!defined($ip)) {
+ $ip = PVE::Network::get_ip_from_hostname($server);
+ }
+
+ my $transport = PVE::JSONSchema::pve_verify_ipv4($ip, 1) ? 'tcp' : 'tcp6';
+
# nfsv4 uses a pseudo-filesystem always beginning with /
# no exports are listed
- $cmd = ['/usr/sbin/rpcinfo', '-T', 'tcp', $server, 'nfs', '4'];
+ $cmd = ['/usr/sbin/rpcinfo', '-T', $transport, $ip, 'nfs', '4'];
} else {
$cmd = ['/sbin/showmount', '--no-headers', '--exports', $server];
}
--
2.20.1
next reply other threads:[~2021-03-17 12:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 12:49 Fabian Ebner [this message]
2021-03-31 8:26 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210317124942.14987-1-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=t.lamprecht@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox