[pve-devel] applied: [PATCH storage] Make check_connection less costly.

Wolfgang Bumiller w.bumiller at proxmox.com
Tue May 22 13:19:27 CEST 2018


applied

On Wed, May 16, 2018 at 01:46:42PM +0200, Wolfgang Link wrote:
> This command will only check the needed share
> and do not query the hole server shares.
> 
> This reduce the answer time and also has the benefit we check the
> credentials on this share and not on the server.
> ---
>  PVE/Storage/CIFSPlugin.pm | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm
> index 724fb1f..cb7c844 100644
> --- a/PVE/Storage/CIFSPlugin.pm
> +++ b/PVE/Storage/CIFSPlugin.pm
> @@ -198,9 +198,9 @@ sub deactivate_storage {
>  sub check_connection {
>      my ($class, $storeid, $scfg) = @_;
>  
> -    my $server = $scfg->{server};
> +    my $servicename = '//'.$scfg->{server}.'/'.$scfg->{share};
>  
> -    my $cmd = ['/usr/bin/smbclient', '-L', $server, '-d', '0', '-m'];
> +    my $cmd = ['/usr/bin/smbclient', $servicename, '-d', '0', '-m'];
>  
>      push @$cmd, $scfg->{smbversion} ? "smb".int($scfg->{smbversion}) : 'smb3';
>  
> @@ -211,6 +211,8 @@ sub check_connection {
>  	push @$cmd, '-U', 'Guest','-N';
>      }
>  
> +    push @$cmd, '-c', 'echo 1 0';
> +
>      my $out_str;
>      eval {
>  	run_command($cmd, timeout => 2, outfunc => sub {$out_str .= shift;},
> -- 
> 2.11.0



More information about the pve-devel mailing list