From 92693dc6aed47f2b2bd13216fa379f721b01c049 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Fri, 21 Jul 2023 17:28:29 +0200 Subject: [PATCH] (plugin) storage::purestorage::flasharray::v2::restapi - fix illegal divsion by zero (#4565) --- .../purestorage/flasharray/v2/restapi/mode/volumes.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/storage/purestorage/flasharray/v2/restapi/mode/volumes.pm b/src/storage/purestorage/flasharray/v2/restapi/mode/volumes.pm index 293c87676..a77ca9041 100644 --- a/src/storage/purestorage/flasharray/v2/restapi/mode/volumes.pm +++ b/src/storage/purestorage/flasharray/v2/restapi/mode/volumes.pm @@ -196,15 +196,18 @@ sub manage_selection { name => $item->{name}, reduction => { data => $item->{space}->{data_reduction} - }, - space => { + } + }; + + if ($item->{provisioned} > 0) { + $self->{volumes}->{ $item->{name} }->{space} = { total => $item->{provisioned}, used => $item->{space}->{total_physical}, free => $item->{provisioned} - $item->{space}->{total_physical}, prct_used => $item->{space}->{total_physical} * 100 / $item->{provisioned}, prct_free => (100 - ($item->{space}->{total_physical} * 100 / $item->{provisioned})) - } - }; + }; + } } foreach my $perf (@$perfs) {