diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm index a4d4aa2..1b904c6 100644 --- a/PVE/API2/Disks/ZFS.pm +++ b/PVE/API2/Disks/ZFS.pm @@ -19,9 +19,7 @@ my $ZPOOL = '/sbin/zpool'; my $ZFS = '/sbin/zfs'; sub get_pool_data { - if (!-f $ZPOOL) { - die "zfsutils-linux not installed\n"; - } + die "zfsutils-linux not installed\n" if ! -f $ZPOOL; my $propnames = [qw(name size alloc free frag dedup health)]; my $numbers = { @@ -32,24 +30,21 @@ sub get_pool_data { dedup => 1, }; - my $cmd = [$ZPOOL,'list', '-HpPLo', join(',', @$propnames)]; - my $pools = []; - - run_command($cmd, outfunc => sub { + run_command([$ZPOOL, 'list', '-HpPLo', join(',', @$propnames)], outfunc => sub { my ($line) = @_; - my @props = split('\s+', trim($line)); - my $pool = {}; - for (my $i = 0; $i < scalar(@$propnames); $i++) { - if ($numbers->{$propnames->[$i]}) { - $pool->{$propnames->[$i]} = $props[$i] + 0; - } else { - $pool->{$propnames->[$i]} = $props[$i]; - } + my @props = split('\s+', trim($line)); + my $pool = {}; + for (my $i = 0; $i < scalar(@$propnames); $i++) { + if ($numbers->{$propnames->[$i]}) { + $pool->{$propnames->[$i]} = $props[$i] + 0; + } else { + $pool->{$propnames->[$i]} = $props[$i]; } + } - push @$pools, $pool; + push @$pools, $pool; }); return $pools;