[pve-devel] [PATCH storage] check if zfs tools are installed before using them
Dominik Csapak
d.csapak at proxmox.com
Tue Sep 19 09:03:07 CEST 2017
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
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
More information about the pve-devel
mailing list