mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2024-12-22 13:34:16 +03:00
zfs diskmanage: code/indentation cleanup in get_pool_data
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
0bcfafa471
commit
8b06da647a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user