(plugin) storage::purestorage::flasharray::v2::restapi - fix illegal divsion by zero (#4565)

This commit is contained in:
qgarnier 2023-07-21 17:28:29 +02:00 committed by GitHub
parent e557d62e6a
commit 92693dc6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,16 +196,19 @@ sub manage_selection {
name => $item->{name}, name => $item->{name},
reduction => { reduction => {
data => $item->{space}->{data_reduction} data => $item->{space}->{data_reduction}
}, }
space => { };
if ($item->{provisioned} > 0) {
$self->{volumes}->{ $item->{name} }->{space} = {
total => $item->{provisioned}, total => $item->{provisioned},
used => $item->{space}->{total_physical}, used => $item->{space}->{total_physical},
free => $item->{provisioned} - $item->{space}->{total_physical}, free => $item->{provisioned} - $item->{space}->{total_physical},
prct_used => $item->{space}->{total_physical} * 100 / $item->{provisioned}, prct_used => $item->{space}->{total_physical} * 100 / $item->{provisioned},
prct_free => (100 - ($item->{space}->{total_physical} * 100 / $item->{provisioned})) prct_free => (100 - ($item->{space}->{total_physical} * 100 / $item->{provisioned}))
}
}; };
} }
}
foreach my $perf (@$perfs) { foreach my $perf (@$perfs) {
next if (!defined($self->{volumes}->{ $perf->{name} })); next if (!defined($self->{volumes}->{ $perf->{name} }));