all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Maximiliano Sandoval <m.sandoval@proxmox.com>,
	pve-devel@lists.proxmox.com
Subject: Re: [PATCH storage v2 1/2] nfs: create a helper to run rpcinfo commands
Date: Fri, 20 Mar 2026 13:54:18 +0100	[thread overview]
Message-ID: <7c265ae6-1109-4ac6-a859-f51b78638d52@proxmox.com> (raw)
In-Reply-To: <20260319104241.191910-2-m.sandoval@proxmox.com>

Am 19.03.26 um 11:42 AM schrieb Maximiliano Sandoval:
> Will be used in the next command as a fallback in the NFSv3 case.
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  src/PVE/Storage/NFSPlugin.pm | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/src/PVE/Storage/NFSPlugin.pm b/src/PVE/Storage/NFSPlugin.pm
> index 4cc02c9e..062b3f32 100644
> --- a/src/PVE/Storage/NFSPlugin.pm
> +++ b/src/PVE/Storage/NFSPlugin.pm
> @@ -171,6 +171,20 @@ sub deactivate_storage {
>      }
>  }
>  
> +sub tcp_rpcinfo_cmd {

The helper could be private.

I wouldn't use tcp as a prefix (if using it, rather later in the name).
Other plugins use the plugin name as the prefix for intra-module
helpers. Maybe something like nfs_get_rpcinfo_command?

> +    my ($server, $version) = @_;
> +
> +    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

I feel like putting it on the same line makes it harder to read. There
should be a comma or  dot after the slash. But actually, the comment
does not belong inside the function here, but to the call site. It's the
clarification for why rpcinfo is used rather than listing exports.

> +    return ['/usr/sbin/rpcinfo', '-T', $transport, $ip, 'nfs', $version];
> +}
> +
>  sub check_connection {
>      my ($class, $storeid, $scfg) = @_;
>  
> @@ -181,16 +195,7 @@ sub check_connection {
>  
>      my $is_v4 = defined($opts) && $opts =~ /vers=4.*/;
>      if ($is_v4) {
> -        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', $transport, $ip, 'nfs', '4'];
> +        $cmd = tcp_rpcinfo_cmd($server, '4');
>      } else {
>          $cmd = ['/sbin/showmount', '--no-headers', '--exports', $server];
>      }





  reply	other threads:[~2026-03-20 12:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 10:42 [PATCH storage v2 0/2] nfs: use rpcinfo as a showmounts fallback for nfs3 Maximiliano Sandoval
2026-03-19 10:42 ` [PATCH storage v2 1/2] nfs: create a helper to run rpcinfo commands Maximiliano Sandoval
2026-03-20 12:54   ` Fiona Ebner [this message]
2026-03-19 10:42 ` [PATCH storage v2 2/2] nfs: use rpcinfo as a showmounts fallback for nfs3 Maximiliano Sandoval
2026-03-20 12:54   ` Fiona Ebner
2026-03-20 14:00     ` Maximiliano Sandoval
2026-03-20 14:17       ` Fiona Ebner

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=7c265ae6-1109-4ac6-a859-f51b78638d52@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=m.sandoval@proxmox.com \
    --cc=pve-devel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal