[pve-devel] [PATCH storage] check if zfs tools are installed before using them

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Sep 19 09:17:31 CEST 2017


On Tue, Sep 19, 2017 at 09:03:07AM +0200, Dominik Csapak wrote:
> else we get a warning everytime somebody uses the disklist and
> has no zfs installed (e.g. when creating ceph osds)
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> this patch really only introduces an if around the eval
> and removes the comment, but it adds an indendation level so
> best review without whitespace changes

maybe we should move zfsutils-linux into the required set and load the
modules again on boot? the zfsutils package only contains the userspace
stuff anyhow, the kernel already contains the modules, so this is not
really problematic?

>  PVE/Diskmanage.pm | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
> index e1db2ae..6862d09 100644
> --- a/PVE/Diskmanage.pm
> +++ b/PVE/Diskmanage.pm
> @@ -152,19 +152,18 @@ sub get_zfs_devices {
>      # use zpool and parttype uuid,
>      # because log and cache do not have
>      # zfs type uuid
> -    eval {
> -	run_command([$ZPOOL, 'list', '-HPLv'], outfunc => sub {
> -	     my ($line) = @_;
> -
> -	     if ($line =~ m|^\t([^\t]+)\t|) {
> -		$list->{$1} = 1;
> -	     }
> -	});
> -    };
> -
> -    # only warn here,
> -    # because maybe zfs tools are not installed
> -    warn "$@\n" if $@;
> +    if (-e $ZPOOL) {
> +	eval {
> +	    run_command([$ZPOOL, 'list', '-HPLv'], outfunc => sub {
> +		    my ($line) = @_;
> +
> +		    if ($line =~ m|^\t([^\t]+)\t|) {
> +			$list->{$1} = 1;
> +		    }
> +		});
> +	};
> +	warn "$@\n" if $@;
> +    }
>  
>      my $applezfsuuid = "6a898cc3-1dd2-11b2-99a6-080020736631";
>      my $bsdzfsuuid = "516e7cba-6ecf-11d6-8ff8-00022d09712b";
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list